Skip to content

Commit 0e8a5a3

Browse files
Resolve a symlink inconshreveable#39
1 parent 6bc99ae commit 0e8a5a3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

apply.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,17 @@ func (o *Options) SetPublicKeyPEM(pembytes []byte) error {
270270

271271
func (o *Options) getPath() (string, error) {
272272
if o.TargetPath == "" {
273-
return osext.Executable()
273+
exe, err := osext.Executable()
274+
if err != nil {
275+
return "", err
276+
}
277+
278+
exe, err = filepath.EvalSymlinks(exe)
279+
if err != nil {
280+
return "", err
281+
}
282+
283+
return exe, nil
274284
} else {
275285
return o.TargetPath, nil
276286
}

0 commit comments

Comments
 (0)