From 54f4dc8f6e224e3842225b508715f42b065b6ad4 Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Tue, 14 Feb 2023 11:17:09 +0000 Subject: [PATCH] controller: set absolute path of server binary before execution Signed-off-by: Justin Chadwell --- controller/remote/controller.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/controller/remote/controller.go b/controller/remote/controller.go index 7ba70ff6..3e3303a6 100644 --- a/controller/remote/controller.go +++ b/controller/remote/controller.go @@ -296,7 +296,12 @@ func (c *buildxController) Kill(ctx context.Context) error { } func launch(ctx context.Context, logFile string, args ...string) (func() error, error) { - bCmd := exec.CommandContext(ctx, os.Args[0], args...) + // set absolute path of binary, since we set the working directory to the root + pathname, err := filepath.Abs(os.Args[0]) + if err != nil { + return nil, err + } + bCmd := exec.CommandContext(ctx, pathname, args...) if logFile != "" { f, err := os.OpenFile(logFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) if err != nil {