mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 13:53:10 +00:00
postfork: Also check shebang/interpreter for EACCESS
This happens e.g. with a shebang of "#!/bin/" - we would complain about EACCESS, even tho accessing *the file to run* worked.
This commit is contained in:
parent
afd242b14d
commit
ead0b03108
1 changed files with 5 additions and 7 deletions
|
@ -453,6 +453,7 @@ void safe_report_exec_error(int err, const char *actual_cmd, const char *const *
|
|||
break;
|
||||
}
|
||||
|
||||
case EACCES:
|
||||
case ENOENT: {
|
||||
// ENOENT is returned by exec() when the path fails, but also returned by posix_spawn if
|
||||
// an open file action fails. These cases appear to be impossible to distinguish. We
|
||||
|
@ -481,24 +482,21 @@ void safe_report_exec_error(int err, const char *actual_cmd, const char *const *
|
|||
"Failed to execute process '%s': The file exists and is executable. "
|
||||
"Check the interpreter or linker?",
|
||||
actual_cmd);
|
||||
} else {
|
||||
} else if (err == ENOENT) {
|
||||
FLOGF_SAFE(exec,
|
||||
"Failed to execute process '%s': The file does not exist or could not "
|
||||
"be executed.",
|
||||
actual_cmd);
|
||||
} else {
|
||||
FLOGF_SAFE(exec, "Failed to execute process '%s': The file could not be accessed.",
|
||||
actual_cmd);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ENOMEM: {
|
||||
FLOGF_SAFE(exec, "Out of memory");
|
||||
break;
|
||||
}
|
||||
case EACCES: {
|
||||
FLOGF_SAFE(exec, "Failed to execute process '%s': The file could not be accessed.",
|
||||
actual_cmd);
|
||||
break;
|
||||
}
|
||||
case ETXTBSY: {
|
||||
FLOGF_SAFE(exec, "Failed to execute process '%s': File is currently open for writing.",
|
||||
actual_cmd);
|
||||
|
|
Loading…
Reference in a new issue