Commit 5d19b589 authored by Jakub Sztandera's avatar Jakub Sztandera

coverage: fix race of signal vs start of a process

License: MIT
Signed-off-by: default avatarJakub Sztandera <kubuxu@protonmail.ch>
parent f0810002
......@@ -43,15 +43,26 @@ func main() {
Pdeathsig: syscall.SIGTERM,
}
sig := make(chan os.Signal, 1)
sig := make(chan os.Signal, 10)
start := make(chan struct{})
go func() {
<-start
for {
p.Process.Signal(<-sig)
}
}()
signal.Notify(sig, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM)
err = p.Run()
err = p.Start()
if err != nil {
fmt.Println(err.Error())
os.Exit(1)
}
close(start)
err = p.Wait()
if err != nil {
fmt.Println(err.Error())
os.Exit(1)
......
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