mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-20 21:57:14 +08:00
Return proper exec error also for relative shebangs
As seen in https://stackoverflow.com/questions/70139844/how-to-execute-custom-fish-scripts-in-custom-path-folder, making a shebang like #!usr/bin/fish won't work, and will error with the default "file does not exist" error *pointing to the file, not the interpreter*. Detect that interpreter properly. We might want to make this an even more specific error, but now it says ``` exec: Failed to execute process '/home/alfa/.local/bin/borken.fish': The file specified the interpreter 'usr/bin/fish', which is not an executable command. ``` Which is okay.
This commit is contained in:
parent
29fa8b776c
commit
a07187f46f
|
@ -540,6 +540,9 @@ static char *get_interpreter(const char *command, char *buffer, size_t buff_size
|
|||
return buffer + 3;
|
||||
} else if (std::strncmp(buffer, "#!/", const_strlen("#!/")) == 0) {
|
||||
return buffer + 2;
|
||||
} else if (std::strncmp(buffer, "#!", const_strlen("#!")) == 0) {
|
||||
// Relative path, basically always an issue.
|
||||
return buffer + 2;
|
||||
}
|
||||
return nullptr;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user