MCPcopy Index your code
hub / github.com/cloudfoundry/cli / catchSignal

Function catchSignal

util/configv3/write_config.go:62–66  ·  view source on GitHub ↗

catchSignal tries to catch SIGHUP, SIGINT, SIGKILL, SIGQUIT and SIGTERM, and Interrupt for removing temporarily created config files before the program ends. Note: we cannot intercept a `kill -9`, so a well-timed `kill -9` will allow a temp config file to linger.

(sig chan os.Signal, tempConfigFileName string)

Source from the content-addressed store, hash-verified

60// ends. Note: we cannot intercept a `kill -9`, so a well-timed `kill -9`
61// will allow a temp config file to linger.
62func catchSignal(sig chan os.Signal, tempConfigFileName string) {
63 <-sig
64 _ = os.Remove(tempConfigFileName)
65 os.Exit(2)
66}

Callers 1

WriteConfigMethod · 0.70

Calls 1

ExitMethod · 0.65

Tested by

no test coverage detected