Files
docker-cli/cli/command
Laura Brehm 30c4637f03 run: don't hang if only attaching STDIN
If STDOUT or STDERR are attached and the container exits, the streams
will be closed by the daemon while the container is exiting, causing
the streamer to return an error
61b02e636d/cli/command/container/hijack.go (L53)
that gets sent
61b02e636d/cli/command/container/run.go (L278)
and received
61b02e636d/cli/command/container/run.go (L225)
on `errCh`.

However, if only STDIN is attached, it's not closed (since this is
attached to the user's TTY) when the container exits, so the streamer
doesn't exit and nothing gets sent on `errCh`, meaning the CLI execution
hangs receiving on `errCh` on L231.

Change the logic to receive on both `errCh` and `statusChan` – this way,
if the container exits, we get notified on `statusChan` (even if only
STDIN is attached), and can cancel the streamer and exit.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2024-12-09 15:49:20 +00:00
..
2024-07-04 01:35:12 +02:00
2024-11-12 12:38:18 +01:00
2024-11-12 12:38:18 +01:00
2024-11-12 12:38:18 +01:00
2024-11-12 12:38:18 +01:00
2024-11-12 12:38:18 +01:00
2024-11-12 12:38:18 +01:00
2024-11-12 12:38:18 +01:00
2024-11-12 12:38:18 +01:00
2024-11-12 12:38:18 +01:00
2024-11-12 12:38:18 +01:00
2024-11-27 16:46:34 +00:00
2024-11-12 12:38:18 +01:00