From 3778cc36f4cdecf0d8437c0c69cdeb33243492bc Mon Sep 17 00:00:00 2001 From: Chris Ayoub Date: Sun, 9 Aug 2026 20:25:31 +0000 Subject: [PATCH] ctr: drain exec output before cleanup Wait for stdout and stderr copying to complete after validating process exit so deferred process deletion does not cancel readers with output still in flight. Signed-off-by: Chris Ayoub --- cmd/ctr/commands/tasks/exec.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/ctr/commands/tasks/exec.go b/cmd/ctr/commands/tasks/exec.go index 4e341f21d1cf3..6f7b7816505e4 100644 --- a/cmd/ctr/commands/tasks/exec.go +++ b/cmd/ctr/commands/tasks/exec.go @@ -186,6 +186,8 @@ var execCommand = &cli.Command{ if err != nil { return err } + process.IO().Wait() + process.IO().Close() if code != 0 { return cli.Exit("", int(code)) }