mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 00:47:48 +08:00

See https://github.com/docker/cli/pull/4599 and https://github.com/docker/cli/pull/4769. Since we switched to using the cobra command context instead of `appcontext`, we need to set up the signal handling that was being provided by `appcontext`, as well as configuring the context with the OTEL tracing utilities also used by `appcontext`. This commit introduces `cobrautil.ConfigureContext` which implements the pre-existing signal handling logic from `appcontext` and cancels the command's context when a signal is received, as well as doing the relevant OTEL config. Signed-off-by: Laura Brehm <laurabrehm@hey.com>
11 lines
145 B
Go
11 lines
145 B
Go
//go:build !windows
|
|
|
|
package cobrautil
|
|
|
|
import (
|
|
"golang.org/x/sys/unix"
|
|
"os"
|
|
)
|
|
|
|
var interruptSignals = []os.Signal{unix.SIGTERM, unix.SIGINT}
|