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

Implementing semantics about traps #109

Closed
13 tasks done
Tracked by #51
magicant opened this issue Nov 1, 2021 · 1 comment
Closed
13 tasks done
Tracked by #51

Implementing semantics about traps #109

magicant opened this issue Nov 1, 2021 · 1 comment
Labels
tracker List of subtasks

Comments

@magicant
Copy link
Owner

magicant commented Nov 1, 2021

More trap-related tasks tracked in #260

@magicant
Copy link
Owner Author

Run traps while reading commands

POSIX does not precisely specify when the shell should execute trap commands. Some shells (bash, dash, and mksh) do not seem to run them while waiting for command-line input. If their behavior is acceptable, yash-rs's implementation can be simpler than the current yash.

If yash-rs is going to run traps while reading input, we will need a clever trick to make it possible to read input and run commands simultaneously. Especially:

  • Running commands requires a mutable reference to the entire Env while the lexer and parser also need a (non-mutable) reference to the alias set.
  • The shell must suspend reading when it receives a signal. In other words, the shell must not read input while running traps.
  • If line-editing is active, the shell should also suspend it while running traps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tracker List of subtasks
Projects
Status: Done
Development

No branches or pull requests

1 participant