summaryrefslogtreecommitdiffhomepage
path: root/pkg/proc/exec.go
diff options
context:
space:
mode:
authorLantao Liu <taotaotheripper@gmail.com>2019-01-15 04:55:38 -0800
committerIan Lewis <ianlewis@google.com>2019-01-15 21:55:38 +0900
commitf39907aa5d3d1b4ffb2dc0bb08954da1dea6f0b8 (patch)
tree2fef65c830cfc0b55567b33535ab2a531f6a25fb /pkg/proc/exec.go
parentc120d7ee2d46a93551075667a01a15bdec8ec1a9 (diff)
Port containerd fix https://github.com/containerd/containerd/pull/2877. (#12)
Adds a timeout and cancel to shim fifo open Signed-off-by: Lantao Liu <lantaol@google.com>
Diffstat (limited to 'pkg/proc/exec.go')
-rw-r--r--pkg/proc/exec.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/proc/exec.go b/pkg/proc/exec.go
index f52e1afdd..9b729e917 100644
--- a/pkg/proc/exec.go
+++ b/pkg/proc/exec.go
@@ -191,6 +191,12 @@ func (e *execProcess) start(ctx context.Context) (err error) {
e.stdin = sc
}
var copyWaitGroup sync.WaitGroup
+ ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
+ defer func() {
+ if err != nil {
+ cancel()
+ }
+ }()
if socket != nil {
console, err := socket.ReceiveMaster()
if err != nil {