-
Notifications
You must be signed in to change notification settings - Fork 463
Support cancellation of subcommands in swift-syntax-dev-utils using Ctrl-C
#2172
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
Conversation
|
@swift-ci Please test |
c2b2e7b to
2a361c9
Compare
|
@swift-ci Please test |
|
@swift-ci Please test Windows |
1 similar comment
|
@swift-ci Please test Windows |
bnbarham
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... unfortunate that this isn't handled by Process :(
| try command.run() | ||
| } catch { | ||
| if !SigIntListener.hasReceivedSigInt { | ||
| // No point printing an error message if the user requested the termiation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // No point printing an error message if the user requested the termiation | |
| // No point printing an error message if the user requested the termination |
| signal(SIGINT) { _ in | ||
| SigIntListener.hasReceivedSigInt = true | ||
| for process in SigIntListener.runningSubprocesses { | ||
| kill(process.processIdentifier, SIGINT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a Process.terminate and Process.interrupt you could use instead signalling directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, nice. I didn’t know about that.
… Ctrl-C It’s really quite unfortunate that we need to do all this handling ourselves…
2a361c9 to
04cf52d
Compare
|
@swift-ci Please test |
|
@swift-ci Please test Windows |
It’s really quite unfortunate that we need to do all this handling ourselves…