$ go get -d github.com/iwdgo/sigintwindows
$ cd <download path>
$ go test -v
=== RUN TestSendCtrlBreak
signal_windows_test.go:40: waiting 5 seconds before goroutine. No log to find.
signal_windows_test.go:43: waiting 5 seconds in goroutine. Log displays unless interrupted.
2021/09/22 10:39:38 sub-process 55536 started
2021/09/22 10:39:48 graceful exit on interrupt
--- PASS: TestSendCtrlBreak (15.38s)
PASS
The output of the sub-process is in the ctrlbreak.log
file.
Typing Ctrl-C should display error exit status 0xc000013a
Exit code 0xC000013A
is the exit value STATUS_CONTROL_C_EXIT
returned by the signal package.
NTSTATUS says:
{Application Exit by CTRL+C} The application terminated as a result of a CTRL+C.
import "github.com/iwdgo/sigintwindows"
sigintwindows.SendCtrlBreak(<some pid>)
https://stackoverflow.com/questions/45309984/signal-other-than-sigkill-not-terminating-process-on-windows
https://stackoverflow.com/questions/55092139/gracefully-terminate-a-process-on-windows
golang/go#29744
golang/go#42311
golang/go#46354
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55
https://docs.microsoft.com/en-us/windows/console/generateconsolectrlevent
https://docs.microsoft.com/en-us/windows/console/ctrl-c-and-ctrl-break-signals
https://docs.microsoft.com/en-us/windows/win32/procthread/process-creation-flags
v0.2.2
Importable module
v0.1.0
Standalone experiment
Standalone version of the test TestCtrlBreak
of the signal
package of golang.