proc

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

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

func Run(cmd *exec.Cmd) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL