From a3d9fc49414b5e6972e589d2baa8df676a984c9b Mon Sep 17 00:00:00 2001 From: Laura Brehm Date: Mon, 2 Dec 2024 10:21:53 +0000 Subject: [PATCH] =?UTF-8?q?run:=20cleanup=20=E2=80=93=20remove=20`errCh`?= =?UTF-8?q?=20nil=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now, if running in "detached" mode, we early exit at L222. Similarly, if `attachContainer` errors out, it returns an error that gets handled on L190. As such, `errCh` can never be nil on L231. Remove the nil check. Signed-off-by: Laura Brehm --- cli/command/container/run.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/cli/command/container/run.go b/cli/command/container/run.go index 83f737c9e0af..ed4c96574c5f 100644 --- a/cli/command/container/run.go +++ b/cli/command/container/run.go @@ -228,16 +228,14 @@ func runContainer(ctx context.Context, dockerCli command.Cli, runOpts *runOption } } - if errCh != nil { - if err := <-errCh; err != nil { - if _, ok := err.(term.EscapeError); ok { - // The user entered the detach escape sequence. - return nil - } - - logrus.Debugf("Error hijack: %s", err) - return err + if err := <-errCh; err != nil { + if _, ok := err.(term.EscapeError); ok { + // The user entered the detach escape sequence. + return nil } + + logrus.Debugf("Error hijack: %s", err) + return err } status := <-statusChan