MCPcopy Create free account
hub / github.com/docker/docker-language-server / setupSignalHandler

Function setupSignalHandler

internal/pkg/cli/cli.go:75–87  ·  view source on GitHub ↗
(cancel context.CancelFunc)

Source from the content-addressed store, hash-verified

73}
74
75func setupSignalHandler(cancel context.CancelFunc) {
76 c := make(chan os.Signal, 1)
77 signal.Notify(c, os.Interrupt)
78 go func() {
79 for sig := range c {
80 if sig == os.Interrupt {
81 // TODO(milas): give open conns a grace period to close gracefully
82 cancel()
83 os.Exit(0)
84 }
85 }
86 }()
87}
88
89func isCobraError(err error) bool {
90 // Cobra doesn't give us a good way to distinguish between Cobra errors

Callers 1

ExecuteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected