summaryrefslogtreecommitdiffstats
path: root/src/core.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/core.go')
-rw-r--r--src/core.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/core.go b/src/core.go
index ae5e58bf..8253c49e 100644
--- a/src/core.go
+++ b/src/core.go
@@ -3,7 +3,6 @@ package fzf
import (
"fmt"
- "os"
"time"
"unsafe"
@@ -29,6 +28,8 @@ func sbytes(data string) []byte {
// Run starts fzf
func Run(opts *Options, version string, revision string) {
+ defer util.RunAtExitFuncs()
+
sort := opts.Sort > 0
sortCriteria = opts.Criteria
@@ -38,7 +39,7 @@ func Run(opts *Options, version string, revision string) {
} else {
fmt.Println(version)
}
- os.Exit(exitOk)
+ util.Exit(exitOk)
}
// Event channel
@@ -189,9 +190,9 @@ func Run(opts *Options, version string, revision string) {
}
}
if found {
- os.Exit(exitOk)
+ util.Exit(exitOk)
}
- os.Exit(exitNoMatch)
+ util.Exit(exitNoMatch)
}
// Synchronous search
@@ -270,7 +271,7 @@ func Run(opts *Options, version string, revision string) {
if reading {
reader.terminate()
}
- os.Exit(value.(int))
+ util.Exit(value.(int))
case EvtReadNew, EvtReadFin:
if evt == EvtReadFin && nextCommand != nil {
restart(*nextCommand, nextEnviron)
@@ -372,9 +373,9 @@ func Run(opts *Options, version string, revision string) {
opts.Printer(val.Get(i).item.AsString(opts.Ansi))
}
if count > 0 {
- os.Exit(exitOk)
+ util.Exit(exitOk)
}
- os.Exit(exitNoMatch)
+ util.Exit(exitNoMatch)
}
determine(val.final)
}