Commit 67ca4425 authored by Sebastian Stark's avatar Sebastian Stark

Properly exit on signal during initial waiting time

  - otherwise the deferred unlocking would not happen
parent 8ffc56d1
......@@ -6,6 +6,7 @@
package main
import (
"errors"
"fmt"
"log"
"os"
......@@ -62,7 +63,13 @@ func subcmdRun() (ferr error) {
pl.Lock()
defer pl.Unlock()
if !config.NoWait {
time.Sleep(time.Second * 30)
sigc := make(chan os.Signal, 1)
signal.Notify(sigc, syscall.SIGINT, syscall.SIGTERM)
select {
case <-sigc:
return errors.New("-> Early exit")
case <-time.After(time.Second * 30):
}
}
createExit := make(chan bool)
createExitDone := make(chan error)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment