-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1782 from CortexFoundation/dev
all: make vendored copy of reexec
- Loading branch information
Showing
18 changed files
with
58 additions
and
2,735 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// This file originates from Docker/Moby, | ||
// https://github.com/moby/moby/blob/master/pkg/reexec/ | ||
// Licensed under Apache License 2.0: https://github.com/moby/moby/blob/master/LICENSE | ||
// Copyright 2013-2018 Docker, Inc. | ||
|
||
//go:build linux | ||
|
||
package reexec | ||
|
||
// Self returns the path to the current process's binary. | ||
// Returns "/proc/self/exe". | ||
func Self() string { | ||
return "/proc/self/exe" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// This file originates from Docker/Moby, | ||
// https://github.com/moby/moby/blob/master/pkg/reexec/ | ||
// Licensed under Apache License 2.0: https://github.com/moby/moby/blob/master/LICENSE | ||
// Copyright 2013-2018 Docker, Inc. | ||
|
||
//go:build !linux | ||
|
||
package reexec | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
"path/filepath" | ||
) | ||
|
||
// Self returns the path to the current process's binary. | ||
// Uses os.Args[0]. | ||
func Self() string { | ||
name := os.Args[0] | ||
if filepath.Base(name) == name { | ||
if lp, err := exec.LookPath(name); err == nil { | ||
return lp | ||
} | ||
} | ||
// handle conversion of relative paths to absolute | ||
if absName, err := filepath.Abs(name); err == nil { | ||
return absName | ||
} | ||
// if we couldn't get absolute name, return original | ||
// (NOTE: Go only errors on Abs() if os.Getwd fails) | ||
return name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.