Documentation
¶
Overview ¶
Package proc runs wrapped external tools (aws, terraform, cdk, sam, az, and extensions) so that termination signals reach the child gracefully instead of hard-killing it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run starts cmd, waits for it to exit, and returns the same error cmd.Run would. It ensures SIGINT/SIGTERM reach the wrapped tool exactly once so it can clean up instead of being SIGKILLed the instant lstk's context is cancelled.
When cmd was created with exec.CommandContext, its default Cancel hard-kills the child (SIGKILL) as soon as the context is done — which is exactly what happens on Ctrl-C, since lstk cancels its root context on SIGINT/SIGTERM. Run disarms that: a cancelled context no longer kills the child, so the tool terminates from the signal it receives and lstk waits for it to finish its own shutdown. Returning os.ErrProcessDone from Cancel both suppresses the kill and avoids injecting context.Canceled into the wait result, so the tool's real exit code is preserved.
Received signals are relayed per shouldForward: SIGTERM always, SIGINT only when lstk is not attached to a terminal (an attached terminal already delivers Ctrl-C to the child via the foreground process group). npm/launcher.js forwards unconditionally instead — safe there because its child is lstk, which tolerates duplicate signals; wrapped tools like terraform do not.
Types ¶
This section is empty.