Skip to content

Commit 7f6ca6f

Browse files
committed
Use absolute path for running post_install script
1 parent 7526b22 commit 7f6ca6f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

arduino/cores/packagemanager/install_uninstall.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,28 @@ func (pm *PackageManager) InstallPlatform(platformRelease *cores.PlatformRelease
4747
}
4848

4949
func (pm *PackageManager) runPostInstallScript(destDir *paths.Path) error {
50+
absDestDir, err := destDir.Abs()
51+
if err != nil {
52+
return err
53+
}
5054
postInstallFilename := "post_install.sh"
5155
if runtime.GOOS == "windows" {
5256
postInstallFilename = "post_install.bat"
5357
}
54-
postInstall := destDir.Join(postInstallFilename)
58+
postInstall := absDestDir.Join(postInstallFilename)
5559
if postInstall.Exist() && postInstall.IsNotDir() {
5660
cmd, err := executils.Command(postInstall.String())
5761
if err != nil {
5862
return err
5963
}
60-
cmd.Dir = destDir.String()
64+
cmd.Dir = absDestDir.String()
6165
cmd.Stdout = nil
6266
cmd.Stderr = nil
6367
if err := cmd.Run(); err != nil {
6468
return err
6569
}
6670
}
6771
return nil
68-
6972
}
7073

7174
// IsManagedPlatformRelease returns true if the PlatforRelease is managed by the PackageManager

0 commit comments

Comments
 (0)