Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider variable assignments during command search (rehash of #20) #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ script:
- make -C src/ test
- TEST_DEBUG=1 TEST_TIMEOUT=15 make -C tests/ test # higher timeout for CI (default is 9s)

# RUN MODERNISH TESTS (WHICH WILL HAVE SOME FAILURES WITH DASH'S PARSER)
- yes n | modernish/install.sh -s smoosh 2>&1 | tee modernish.log || true
- test "$(grep BUG modernish.log)" = ' LOCALVARS TRAPPRSUBSH BUG_MULTIBYTE' || echo "Expected BUG_MULTIBYTE (and no others)"
- test "$(grep FAIL modernish.log | cut -c3,4,5)" = '002' || echo 'Expected ASCII char failure'

# BUILD AND TEST WEB SERVER
- (cd web; bundle install)
- sh web/src/mk_config.sh $(pwd) >web/src/config.yml
Expand Down
9 changes: 6 additions & 3 deletions src/command.lem
Original file line number Diff line number Diff line change
Expand Up @@ -2783,11 +2783,14 @@ let run_command s0 opts checked prog_name argv env =
Right (s3, stmt, restore)
end
| Nothing ->
match check_execve Nothing (* no prefix *) s1 prog with
| (s2, Nothing) ->
let ts0 = push_locals s1 env in
match check_execve Nothing (* no prefix *) ts0 prog with
| (ts1, Nothing) ->
let (s2, _) = pop_locals ts1 in
(* failed... and emitted an error message and set the ec *)
Right (s2, Done, true)
| (s2, Just executable) ->
| (ts1, Just executable) ->
let (s2, _) = pop_locals ts1 in
let cmd = symbolic_string_of_string executable in
let exported = exported_set_vars s2 in
(* use env to override exports---impl as Pmap.(union) *)
Expand Down
3 changes: 3 additions & 0 deletions tests/shell/semantics.command.path.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
OLDPATH="$PATH"
PATH=""
PATH="$OLDPATH" cat </dev/null