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

trap doesn't accept / ignore -- #662

Closed
andychu opened this issue Mar 15, 2020 · 2 comments
Closed

trap doesn't accept / ignore -- #662

andychu opened this issue Mar 15, 2020 · 2 comments

Comments

@andychu
Copy link
Contributor

andychu commented Mar 15, 2020

11. BUG: trap doesn't ignore --

I can find similar behavior for eval though I haven't checked the other builtins. In Bash, when one needs to pass an arbitrary value to trap / eval, one needs to specify -- because, for example, command=--help; eval "$command" will not be interpreted as expected.

$ osh -c 'trap "echo hello" INT'
$ osh -c 'trap -- "echo hello" INT'
  trap -- "echo hello" INT
          ^
[ -c flag ]:1: Invalid signal or hook 'echo hello'
$ osh -c 'eval -- echo hello'
  -- echo hello
  ^~
[ eval at line 1 of -c flag ]:1: '--' not found

Originally posted by @akinomyoga in #653 (comment)

@andychu
Copy link
Contributor Author

andychu commented Mar 15, 2020

Making this a separate issue since it was marked with two stars

andychu pushed a commit that referenced this issue Mar 15, 2020
andychu pushed a commit that referenced this issue Mar 18, 2020
Test out some more error conditions.

Addresses issue #662.
andychu pushed a commit that referenced this issue Mar 18, 2020
@andychu
Copy link
Contributor Author

andychu commented Mar 25, 2020

@andychu andychu closed this as completed Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant