Skip to content

Commit

Permalink
[builtin/trap] Fix command line parsing to accept --
Browse files Browse the repository at this point in the history
Addresses issue #662.
  • Loading branch information
Andy Chu committed Mar 18, 2020
1 parent 2851746 commit a197b58
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions osh/builtin_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@ def __init__(self, sig_state, traps, nodes_to_run, ex, errfmt):
def Run(self, cmd_val):
# type: (cmd_value__Argv) -> int

arg, _ = TRAP_SPEC.ParseCmdVal(cmd_val)
arg_r = args.Reader(cmd_val.argv, spids=cmd_val.arg_spids)
arg_r.Next() # skip 'trap'
arg, _ = TRAP_SPEC.Parse(arg_r)

if arg.p: # Print registered handlers
for name, value in self.traps.iteritems():
Expand All @@ -334,8 +336,6 @@ def Run(self, cmd_val):

return 0

arg_r = args.Reader(cmd_val.argv, spids=cmd_val.arg_spids)
arg_r.Next() # skip argv[0]
code_str = arg_r.ReadRequired('requires a code string')
sig_spec, sig_spid = arg_r.ReadRequired2('requires a signal or hook name')

Expand Down
4 changes: 2 additions & 2 deletions test/spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ builtins() {
}

builtin-eval-source() {
sh-spec spec/builtin-eval-source.test.sh --no-cd-tmp --osh-failures-allowed 1 \
sh-spec spec/builtin-eval-source.test.sh --no-cd-tmp \
${REF_SHELLS[@]} $ZSH $OSH_LIST "$@"
}

Expand Down Expand Up @@ -431,7 +431,7 @@ builtin-bracket() {
}

builtin-trap() {
sh-spec spec/builtin-trap.test.sh --no-cd-tmp --osh-failures-allowed 4 \
sh-spec spec/builtin-trap.test.sh --no-cd-tmp --osh-failures-allowed 3 \
${REF_SHELLS[@]} $OSH_LIST "$@"
}

Expand Down

0 comments on commit a197b58

Please sign in to comment.