mirror of
https://github.com/MontFerret/ferret.git
synced 2025-07-17 01:32:22 +02:00
Fixed graceful process termination (#240)
This commit is contained in:
13
cli/exec.go
13
cli/exec.go
@ -9,7 +9,6 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func ExecFile(pathToFile string, opts Options) {
|
||||
@ -38,18 +37,10 @@ func Exec(query string, opts Options) {
|
||||
|
||||
l := NewLogger()
|
||||
|
||||
ctx, err := opts.WithContext(context.Background())
|
||||
ctx, cancel := opts.WithContext(context.Background())
|
||||
|
||||
if err != nil {
|
||||
fmt.Println("Failed to register HTML drivers")
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
return
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGHUP)
|
||||
signal.Notify(c, os.Interrupt)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
|
Reference in New Issue
Block a user