mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-30 11:21:15 -03:00
@@ -360,10 +360,17 @@ void safe_report_exec_error(int err, const char *actual_cmd, const char *const *
|
||||
const char *interpreter =
|
||||
get_interpreter(actual_cmd, interpreter_buff, sizeof interpreter_buff);
|
||||
if (interpreter && 0 != access(interpreter, X_OK)) {
|
||||
debug_safe(0,
|
||||
"The file '%s' specified the interpreter '%s', which is not an "
|
||||
"executable command.",
|
||||
actual_cmd, interpreter);
|
||||
// Detect windows line endings and complain specifically about them.
|
||||
auto len = strlen(interpreter);
|
||||
if (len && interpreter[len - 1] == '\r') {
|
||||
debug_safe(0,
|
||||
"The file uses windows line endings (\\r\\n). Run dos2unix or similar to fix it.");
|
||||
} else {
|
||||
debug_safe(0,
|
||||
"The file '%s' specified the interpreter '%s', which is not an "
|
||||
"executable command.",
|
||||
actual_cmd, interpreter);
|
||||
}
|
||||
} else {
|
||||
debug_safe(0, "The file '%s' does not exist or could not be executed.", actual_cmd);
|
||||
}
|
||||
|
||||
@@ -9,5 +9,15 @@ not exec cat <nosuchfile
|
||||
#CHECKERR: open: No such file or directory
|
||||
echo "neg failed: $status"
|
||||
#CHECK: neg failed: 0
|
||||
|
||||
set -l f (mktemp)
|
||||
echo "#!/bin/sh"\r\n"echo foo" > $f
|
||||
chmod +x $f
|
||||
$f
|
||||
#CHECKERR: Failed to execute process '{{.*}}'. Reason:
|
||||
#CHECKERR: The file uses windows line endings (\r\n). Run dos2unix or similar to fix it.
|
||||
|
||||
# This needs to be last, because it actually runs exec.
|
||||
exec cat </dev/null
|
||||
echo "not reached"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user