Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 5a89eab

Browse files
committed
do not forward signals to docker CLI
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 8a400d0 commit 5a89eab

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

cli/mobycli/exec.go

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"fmt"
2323
"os"
2424
"os/exec"
25-
"os/signal"
2625
"path/filepath"
2726
"regexp"
2827
"runtime"
@@ -135,35 +134,13 @@ func Exec(_ *cobra.Command) {
135134
os.Exit(0)
136135
}
137136

138-
// RunDocker runs a docker command, and forward signals to the shellout command (stops listening to signals when an event is sent to childExit)
137+
// RunDocker runs a docker command
139138
func RunDocker(childExit chan bool, args ...string) error {
140139
cmd := exec.Command(comDockerCli(), args...)
141140
cmd.Stdin = os.Stdin
142141
cmd.Stdout = os.Stdout
143142
cmd.Stderr = os.Stderr
144143

145-
signals := make(chan os.Signal, 1)
146-
signal.Notify(signals) // catch all signals
147-
go func() {
148-
for {
149-
select {
150-
case sig := <-signals:
151-
if cmd.Process == nil {
152-
continue // can happen if receiving signal before the process is actually started
153-
}
154-
// In go1.14+, the go runtime issues SIGURG as an interrupt to
155-
// support preemptable system calls on Linux. Since we can't
156-
// forward that along we'll check that here.
157-
if isRuntimeSig(sig) {
158-
continue
159-
}
160-
_ = cmd.Process.Signal(sig)
161-
case <-childExit:
162-
return
163-
}
164-
}
165-
}()
166-
167144
return cmd.Run()
168145
}
169146

0 commit comments

Comments
 (0)