From 11b6afb566fd6427fe5d66eee58117997b431678 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Tue, 7 May 2013 21:36:24 +0200 Subject: [PATCH] display id on run -s stdin Upstream-commit: ac0e27699c0dd9306ae0edabeff5d462399c8e74 Component: engine --- components/engine/commands.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/components/engine/commands.go b/components/engine/commands.go index 2af25440dc..1f4c3acfcb 100644 --- a/components/engine/commands.go +++ b/components/engine/commands.go @@ -1132,6 +1132,7 @@ func CmdRun(args ...string) error { if err != nil { return err } + var status int if config.AttachStdin || config.AttachStdout || config.AttachStderr { if err := hijack("POST", "/containers/"+out.Id+"/attach?"+v.Encode(), config.Tty); err != nil { return err @@ -1145,12 +1146,17 @@ func CmdRun(args ...string) error { if err != nil { return err } - os.Exit(out.StatusCode) + status = out.StatusCode } + } - } else { + if !config.AttachStdout && !config.AttachStderr { fmt.Println(out.Id) } + + if status != 0 { + os.Exit(status) + } return nil }