mirror of
https://github.com/MontFerret/ferret.git
synced 2025-01-16 03:21:03 +02:00
Fixed process termination by 'exit' word (#100)
This commit is contained in:
parent
570c1b4548
commit
88188cac2c
14
cli/repl.go
14
cli/repl.go
@ -46,11 +46,15 @@ func Repl(version string, opts Options) {
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGHUP)
|
||||
|
||||
exit := func() {
|
||||
cancel()
|
||||
l.Close()
|
||||
}
|
||||
|
||||
go func() {
|
||||
for {
|
||||
<-c
|
||||
cancel()
|
||||
l.Close()
|
||||
exit()
|
||||
}
|
||||
}()
|
||||
|
||||
@ -86,6 +90,12 @@ func Repl(version string, opts Options) {
|
||||
continue
|
||||
}
|
||||
|
||||
if query == "exit" {
|
||||
exit()
|
||||
os.Exit(0)
|
||||
return
|
||||
}
|
||||
|
||||
program, err := ferret.Compile(query)
|
||||
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user