Skip to content

Commit

Permalink
cmd/buildkitd: move reexec.Init to non-Linux files
Browse files Browse the repository at this point in the history
reexec is only used on Windows and BSD for;

- util/system/getuserinfo (lookup user information)
- source/git (git operations)

updates 698acd3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Jan 15, 2025
1 parent dd06922 commit e1d393e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
5 changes: 0 additions & 5 deletions cmd/buildkitd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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()
}
Expand Down
15 changes: 15 additions & 0 deletions cmd/buildkitd/main_nolinux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//go:build !linux

package main

import (
"os"

"github.com/moby/sys/reexec"
)

func init() {
if reexec.Init() {
os.Exit(0)
}
}

0 comments on commit e1d393e

Please sign in to comment.