Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These changes rework how we do signal handling after #853. It turns out, trying to forward signals is not really what we want.
At the code here is that different platforms behave in different ways with how signals are handled. The specific cause of the remaining issue described in #850 is that on Linux and unix like platforms, the normal behavior on
ctrl+c
is that all processes in the current group get sent actrl+c
.If we forward signals, we receive the
ctrl+c
twice inside MySQL leading to weird behavior. But we also don't want to ignore the signals either, since a singleSIGINT
sent topscale
is still something we want to act on. On Windows though, the current signal handling setup does seem to work as desired.So we have to split things up here per platform. On Unix like platforms, we can use https://pkg.go.dev/syscall#SysProcAttr and set
Foreground
. That will implySetpgid
as well, which means we get a new process group for the process we're spawning and it attaches it to the foreground. That means now MySQL has the foreground as an independent process group, so it gets the signals appropriately and it's as if we'd directly have started MySQL.On Windows we keep using the same signal handling logic mostly, but slightly simplified. Lastly, we fix the warning signal for prod branches since on Windows it looks like
⚠
doesn't actually work.