mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-16 23:33:39 -05:00
Refactor the code so that fzf can be used as a library (#3769)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user