diff options
Diffstat (limited to 'src/util')
| -rw-r--r-- | src/util/atexit.go | 12 | ||||
| -rw-r--r-- | src/util/util_unix.go | 2 | ||||
| -rw-r--r-- | src/util/util_windows.go | 6 |
3 files changed, 5 insertions, 15 deletions
diff --git a/src/util/atexit.go b/src/util/atexit.go index a22a3a96..6212378b 100644 --- a/src/util/atexit.go +++ b/src/util/atexit.go @@ -1,7 +1,6 @@ package util import ( - "os" "sync" ) @@ -25,14 +24,5 @@ func RunAtExitFuncs() { for i := len(fns) - 1; i >= 0; i-- { fns[i]() } -} - -// Exit executes any functions registered with AtExit() then exits the program -// with os.Exit(code). -// -// NOTE: It must be used instead of os.Exit() since calling os.Exit() terminates -// the program before any of the AtExit functions can run. -func Exit(code int) { - defer os.Exit(code) - RunAtExitFuncs() + atExitFuncs = nil } diff --git a/src/util/util_unix.go b/src/util/util_unix.go index 4410a9bf..5a67066b 100644 --- a/src/util/util_unix.go +++ b/src/util/util_unix.go @@ -61,7 +61,7 @@ func (x *Executor) Become(stdin *os.File, environ []string, command string) { shellPath, err := exec.LookPath(x.shell) if err != nil { fmt.Fprintf(os.Stderr, "fzf (become): %s\n", err.Error()) - Exit(127) + os.Exit(127) } args := append([]string{shellPath}, append(x.args, command)...) SetStdin(stdin) diff --git a/src/util/util_windows.go b/src/util/util_windows.go index 7bbf6ee7..f29e33be 100644 --- a/src/util/util_windows.go +++ b/src/util/util_windows.go @@ -97,15 +97,15 @@ func (x *Executor) Become(stdin *os.File, environ []string, command string) { err := cmd.Start() if err != nil { fmt.Fprintf(os.Stderr, "fzf (become): %s\n", err.Error()) - Exit(127) + os.Exit(127) } err = cmd.Wait() if err != nil { if exitError, ok := err.(*exec.ExitError); ok { - Exit(exitError.ExitCode()) + os.Exit(exitError.ExitCode()) } } - Exit(0) + os.Exit(0) } func escapeArg(s string) string { |
