From e1d393edef461d8c5b1ed4c33d2cdbaa1bb2f057 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 15 Jan 2025 00:53:48 +0100 Subject: [PATCH] cmd/buildkitd: move reexec.Init to non-Linux files reexec is only used on Windows and BSD for; - util/system/getuserinfo (lookup user information) - source/git (git operations) updates 698acd328f52545fba4e8b955c52d8f139dde286 Signed-off-by: Sebastiaan van Stijn --- cmd/buildkitd/main.go | 5 ----- cmd/buildkitd/main_nolinux.go | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 cmd/buildkitd/main_nolinux.go 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) + } +}