1
0

Correctly handle empty workdir

This commit is contained in:
dump_stack() 2023-04-07 17:46:36 +00:00
parent c3cf25e523
commit a4f2a31819
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC

View File

@ -200,7 +200,12 @@ func (c container) Run(workdir string, command string) (output string, err error
if c.Volumes.Boot != "" { if c.Volumes.Boot != "" {
args = append(args, "-v", c.Volumes.Boot+":/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...) cmd := exec.Command("docker", args...)