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

do not forward signals to docker CLI #2267

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions cli/mobycli/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"fmt"
"os"
"os/exec"
"os/signal"
"path/filepath"
"regexp"
"runtime"
Expand Down Expand Up @@ -135,35 +134,13 @@ func Exec(_ *cobra.Command) {
os.Exit(0)
}

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

signals := make(chan os.Signal, 1)
signal.Notify(signals) // catch all signals
go func() {
for {
select {
case sig := <-signals:
if cmd.Process == nil {
continue // can happen if receiving signal before the process is actually started
}
// In go1.14+, the go runtime issues SIGURG as an interrupt to
// support preemptable system calls on Linux. Since we can't
// forward that along we'll check that here.
if isRuntimeSig(sig) {
continue
}
_ = cmd.Process.Signal(sig)
case <-childExit:
return
}
}
}()

return cmd.Run()
}

Expand Down
30 changes: 0 additions & 30 deletions cli/mobycli/exec_unix.go

This file was deleted.

23 changes: 0 additions & 23 deletions cli/mobycli/exec_windows.go

This file was deleted.

Loading