Fix bug where itctl doesn't exit on SIGINT/SIGTERM
This commit is contained in:
parent
900be6f2d0
commit
3c31bd2921
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
"context"
|
"context"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
@ -23,6 +24,13 @@ func main() {
|
|||||||
syscall.SIGINT,
|
syscall.SIGINT,
|
||||||
syscall.SIGTERM,
|
syscall.SIGTERM,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// This goroutine ensures that itc
|
||||||
|
go func() {
|
||||||
|
<-ctx.Done()
|
||||||
|
time.Sleep(200*time.Millisecond)
|
||||||
|
os.Exit(0)
|
||||||
|
}()
|
||||||
|
|
||||||
app := cli.App{
|
app := cli.App{
|
||||||
Name: "itctl",
|
Name: "itctl",
|
||||||
|
Loading…
Reference in New Issue
Block a user