Skip to content

Commit

Permalink
fix(cmd/tracerunner): better printing for attach
Browse files Browse the repository at this point in the history
Signed-off-by: Lorenzo Fontana <lo@linux.com>
  • Loading branch information
fntlnz committed Jan 14, 2019
1 parent b23e1ac commit bb9879d
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions pkg/cmd/tracerunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (o *TraceRunnerOptions) Run() error {
}
}

fmt.Println("if you have maps to print, send a SIGINT using Ctrl-C, if you want to interrupt the execution send SIGINT two times")
fmt.Println("if your program has maps to print, send a SIGINT using Ctrl-C, if you want to interrupt the execution send SIGINT two times")
ctx, cancel := context.WithCancel(context.Background())
sigCh := make(chan os.Signal, 1)

Expand All @@ -99,16 +99,19 @@ func (o *TraceRunnerOptions) Run() error {
go func() {
killable := false
defer cancel()
M:
select {
case <-ctx.Done():
return
case <-sigCh:
if !killable {
killable = true
goto M

for {
select {
case <-ctx.Done():
return
case <-sigCh:
if !killable {
killable = true
fmt.Println("\nfirst SIGINT received, now if your program had maps and did not free them it should print them out")
continue
}
return
}
return
}
}()

Expand Down

0 comments on commit bb9879d

Please sign in to comment.