package
0.0.0-20240529132111-def36b4a2b05
Repository: https://github.com/k773/utils.git
Documentation: pkg.go.dev

# Functions

CombinedOutputWithContext interrupts child by sending platform-specific signal to it (see InterruptProcess) on context expiration.
InterruptProcess is a convenience wrapper for InterruptProcessPid.
InterruptProcessPID sends different signals depending on the os: on Linux: sends SIGINT on Windows: sends CTRL_С_EVENT, child process needs to be started with syscall.CREATE_NEW_PROCESS_GROUP, otherwise parent will receive this event too.
SetupAttributesForInterruption should be called before cmd.Start() is called; sets up correct cmd's interruption behaviour: on Windows: sets cmd.SysProcAttr.CreationFlags=syscall.CREATE_NEW_PROCESS_GROUP (so the parent won't receive CTRL_C_EVENT when it is sent to the child) Note: on Windows child process must set make call to SetConsoleCtrlHandler(NULL, FALSE) to be able to receive ctrl+c events.