1
0
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:
Tim Voronov 2018-10-11 13:35:30 -04:00 committed by GitHub
parent 570c1b4548
commit 88188cac2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {