scriptexec: preserve original shell/interpreter path
For example, When failing to execute the script which starts with the above line, an error message does not contain information for /path/to/name. Instead, it contains only name. In addition, if /path/to/dir/, an error message contains empty string for a name of a failed script.
This commit is contained in:
parent
b27e10a32e
commit
df2cf83f8b
10
exec.c
10
exec.c
|
@ -959,11 +959,15 @@ scriptexec(struct op *tp, const char **ap)
|
||||||
}
|
}
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
/*
|
/*
|
||||||
* Use shell/interpreter name without directory if specified
|
* Search shell/interpreter name without directory in PATH
|
||||||
* path does not exist
|
* if specified path does not exist
|
||||||
*/
|
*/
|
||||||
if (ksh_vstrchr_dirsep(sh) && !search_path(sh, path, X_OK, NULL))
|
if (ksh_vstrchr_dirsep(sh) && !search_path(sh, path, X_OK, NULL))
|
||||||
sh = _getname(sh);
|
{
|
||||||
|
cp = search_path(_getname(sh), path, X_OK, NULL);
|
||||||
|
if (cp)
|
||||||
|
sh = cp;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
goto nomagic;
|
goto nomagic;
|
||||||
noshebang:
|
noshebang:
|
||||||
|
|
Loading…
Reference in New Issue