From a4f2a3181912ee366517c2e99439a82c5af65b15 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Fri, 7 Apr 2023 17:46:36 +0000 Subject: [PATCH] Correctly handle empty workdir --- container.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/container.go b/container.go index 10e85a1..c55c5ac 100644 --- a/container.go +++ b/container.go @@ -200,7 +200,12 @@ func (c container) Run(workdir string, command string) (output string, err error if c.Volumes.Boot != "" { args = append(args, "-v", c.Volumes.Boot+":/boot") } - args = append(args, c.name, "bash", "-c", "cd /work && "+command) + args = append(args, c.name, "bash", "-c") + if workdir != "" { + args = append(args, "cd /work && "+command) + } else { + args = append(args, command) + } cmd := exec.Command("docker", args...)