-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It turns out that the previous change breaks shell scripts that assume $0 is relative. This is because scripts that use '#!' don't receive argv[0]. Instead, they will receive the exact path that is passed to execve(). Change our logic to do a better job at keeping the executable path intact. In case argv[0] contains slashes, we can use it as the executable path directly. If we do need to search PATH, then compute the executable path twice: - Once absolute, to be passed to exec.LookPath(). - Once potentially relative, to be passed to execve(). This makes our behaviour more consistent with POSIX shells.
- Loading branch information
1 parent
1524fef
commit 818629e
Showing
2 changed files
with
52 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters