Skip to content

Commit

Permalink
Merge pull request #1069 from carapace-sh/uid-gcompat
Browse files Browse the repository at this point in the history
uid: gcompat workaround
  • Loading branch information
rsteube authored Jan 1, 2025
2 parents 0f537c0 + 63e7a57 commit 62448c7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/uid/uid.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,17 @@ func Flag(cmd *cobra.Command, flag *pflagfork.Flag) *url.URL {

// Executable returns the name of the executable.
func Executable() string {
if executable, err := os.Executable(); err != nil {
executable, err := os.Executable()
if err != nil {
return "echo" // safe fallback that should never happen
} else if filepath.Base(executable) == "cmd.test" {
}
switch base := filepath.Base(executable); base {
case "cmd.test":
return "example" // for `go test -v ./...`
} else {
return filepath.Base(executable)
case "ld-musl-x86_64.so.1":
return filepath.Base(os.Args[0]) // alpine container workaround (gcompat)
default:
return base
}
}

Expand Down

0 comments on commit 62448c7

Please sign in to comment.