Skip to content

Handle SIGNINT (CTRL+C)#154

Open
klaaspieter wants to merge 1 commit into
JohnSundell:masterfrom
klaaspieter:sigint
Open

Handle SIGNINT (CTRL+C)#154
klaaspieter wants to merge 1 commit into
JohnSundell:masterfrom
klaaspieter:sigint

Conversation

@klaaspieter

Copy link
Copy Markdown

I keep killing the server using CTRL+C because that's how I kill pretty much any other long-running CLI task (rails server, brew update, xcodebuild, etc)

Doing so in Publish keeps the Python process active. This handles the SIGINT signal, terminates the server and then kills the CLI.

The signal handling code was taken from SPM.
See: https://github.com/swiftlang/swift-package-manager/blob/80b1e179bef19e6eb71b0d20b2cb471053ae1b2c/Sources/Basics/Cancellator.swift#L70-L96

I keep killing the server using CTRL+C because that's how I kill pretty
much any other long-running CLI task (rails server, brew update,
xcodebuild, etc)

Doing so in Publish keeps the Python process active. This handles the
SIGINT signal, terminates the server and then kills the CLI.

The signal handling code was taken from SPM.
See: https://github.com/swiftlang/swift-package-manager/blob/80b1e179bef19e6eb71b0d20b2cb471053ae1b2c/Sources/Basics/Cancellator.swift#L70-L96
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant