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

[BUG] Wrong signal handling in subshells #206

Open
1 task
itislu opened this issue Mar 15, 2024 · 1 comment
Open
1 task

[BUG] Wrong signal handling in subshells #206

itislu opened this issue Mar 15, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@itislu
Copy link
Collaborator

itislu commented Mar 15, 2024

It looks like the main signal handler is still the main process, not the subshell process.

SIGQUIT in this example should quit the entire subshell, not just cat:

(cat || echo 123)

We still print 123 in this example.

This issue also causes (cat) | (cat) to print too many newlines when Ctrl+C.

This also makes it apparent: (cat || echo 1 && exit 2) || echo $?

@itislu itislu added the bug Something isn't working label Mar 15, 2024
@itislu itislu changed the title [BUG] (cat) | (cat) prints too many newlines when Ctrl+C [BUG] Wrong signal behavior in subshells Mar 16, 2024
@itislu itislu added this to the Signal Handling milestone Mar 16, 2024
@itislu itislu changed the title [BUG] Wrong signal behavior in subshells [BUG] Wrong signal handling in subshells Mar 16, 2024
@itislu
Copy link
Collaborator Author

itislu commented Jun 23, 2024

Options to handle the main process differently:

  1. Create a different handler function for the main process.
  2. Don't kill the main process from child processes. -
    If sth goes bad in the main process it will just ft_clean_and_exit_shell.
  3. Test if kill with negative pid fails if no child processes exist.
    If that's the case, check for that error and kill the current process instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

1 participant