From f1463d62559470db69267a0a7cbe2b2da25e9adc Mon Sep 17 00:00:00 2001 From: MrLYC Date: Sun, 7 May 2023 22:20:23 +0800 Subject: [PATCH] add executable permission for defined binary --- core/utils/pathlib.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/utils/pathlib.go b/core/utils/pathlib.go index d570fe3..0e1995c 100644 --- a/core/utils/pathlib.go +++ b/core/utils/pathlib.go @@ -93,12 +93,13 @@ func (p *PathHelper) SymbolLink(name, target string, mode os.FileMode) error { return errors.Wrapf(err, "get abs target path %s failed", target) } - err = os.Symlink(absTarget, p.Child(name).Path()) + linkFile := p.Child(name).Path() + err = os.Symlink(absTarget, linkFile) if err != nil { return errors.Wrapf(err, "create symbol link failed") } - return os.Chmod(target, os.ModeSymlink|mode) + return os.Chmod(linkFile, os.ModeSymlink|mode) } func (p *PathHelper) CopyFile(name, target string, mode os.FileMode) error { @@ -116,7 +117,7 @@ func (p *PathHelper) CopyFile(name, target string, mode os.FileMode) error { return errors.WithMessagef(err, "copy file failed") } - return os.Chmod(target, mode) + return os.Chmod(path, mode) } func (p *PathHelper) RealPath(name string) (string, error) {