Skip to content

Commit 91ca4f6

Browse files
authored
Update runfiles.go
1 parent 68cbf17 commit 91ca4f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

go/runfiles/runfiles.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,14 @@ func New(opts ...Option) (*Runfiles, error) {
128128
// not the actual executable.
129129
// If the binary is invoked from PATH, then os.Args[0] is just the
130130
// basename of the executable and isn't useful for locating runfiles.
131-
if strings.IndexRune(os.Args[0], filepath.Separator) >= 0 {
131+
if filepath.Base(os.Args[0]) != os.Args[0] {
132132
o.program = ProgramName(os.Args[0])
133133
} else {
134134
exe, err := os.Executable()
135135
if err != nil {
136136
return nil, fmt.Errorf("runfiles: could not determine executable name: %w", err)
137137
}
138-
o.program = ProgramName(os.Args[0])
138+
o.program = ProgramName(exe)
139139
}
140140
}
141141
manifest := ManifestFile(o.program + ".runfiles_manifest")

0 commit comments

Comments
 (0)