diff --git a/cmd/buildkitd/main.go b/cmd/buildkitd/main.go index e6fde905b46f..458ecc28da9b 100644 --- a/cmd/buildkitd/main.go +++ b/cmd/buildkitd/main.go @@ -58,7 +58,6 @@ import ( "github.com/moby/buildkit/util/tracing/transform" "github.com/moby/buildkit/version" "github.com/moby/buildkit/worker" - "github.com/moby/sys/reexec" "github.com/moby/sys/userns" ocispecs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" @@ -81,10 +80,6 @@ func init() { apicaps.ExportedProduct = "buildkit" stack.SetVersionInfo(version.Version, version.Revision) - if reexec.Init() { - os.Exit(0) - } - // enable in memory recording for buildkitd traces detect.Recorder = detect.NewTraceRecorder() } diff --git a/cmd/buildkitd/main_nolinux.go b/cmd/buildkitd/main_nolinux.go new file mode 100644 index 000000000000..028dad097e4d --- /dev/null +++ b/cmd/buildkitd/main_nolinux.go @@ -0,0 +1,15 @@ +//go:build !linux + +package main + +import ( + "os" + + "github.com/moby/sys/reexec" +) + +func init() { + if reexec.Init() { + os.Exit(0) + } +}