Skip to content

Commit bb9879d

Browse files
committed
fix(cmd/tracerunner): better printing for attach
Signed-off-by: Lorenzo Fontana <[email protected]>
1 parent b23e1ac commit bb9879d

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

pkg/cmd/tracerunner.go

+13-10
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func (o *TraceRunnerOptions) Run() error {
9090
}
9191
}
9292

93-
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")
93+
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")
9494
ctx, cancel := context.WithCancel(context.Background())
9595
sigCh := make(chan os.Signal, 1)
9696

@@ -99,16 +99,19 @@ func (o *TraceRunnerOptions) Run() error {
9999
go func() {
100100
killable := false
101101
defer cancel()
102-
M:
103-
select {
104-
case <-ctx.Done():
105-
return
106-
case <-sigCh:
107-
if !killable {
108-
killable = true
109-
goto M
102+
103+
for {
104+
select {
105+
case <-ctx.Done():
106+
return
107+
case <-sigCh:
108+
if !killable {
109+
killable = true
110+
fmt.Println("\nfirst SIGINT received, now if your program had maps and did not free them it should print them out")
111+
continue
112+
}
113+
return
110114
}
111-
return
112115
}
113116
}()
114117

0 commit comments

Comments
 (0)