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

Ignore SIGINT and SIGQUIT in asynchronous command #247

Merged
merged 1 commit into from
Mar 12, 2023

Conversation

magicant
Copy link
Owner

No description provided.

@magicant magicant self-assigned this Mar 10, 2023
@magicant magicant force-pushed the signals_ignored_in_async_cmd branch from 3908d1e to 216fccf Compare March 11, 2023 03:49
@magicant magicant marked this pull request as ready for review March 11, 2023 03:50
POSIX requires that asynchronous items that are not job-controlled
ignore SIGINT and SIGQUIT. This commit implements that behavior.

In this commit, I add the MaskGuard structure, which I use in the
Subshell::start function to remember the original signal-blocking mask
and temporarily block SIGINT and SIGQUIT while forking a child process.
I call System::sigmask directly from MaskGuard, despite the signal
handler controlling mechanisms in TrapSet and SelectSystem, to keep the
implementation simple. If we let TrapSet control the mask, we would need
to extend SignalSystem with a method to block signals, making
SelectSystem more complicated. Such a new public API function would have
to be generic enough to support any combination of API calls, including
those that were unnecessary to achieve our original goal of handling
SIGINT and SIGQUIT.
@magicant magicant force-pushed the signals_ignored_in_async_cmd branch from 216fccf to 035c186 Compare March 11, 2023 15:28
This was referenced Mar 11, 2023
@magicant magicant merged commit 035c186 into master Mar 12, 2023
@magicant magicant deleted the signals_ignored_in_async_cmd branch March 12, 2023 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant