4 ms·
Shells return exit codes, not typed error values. What kind of output would you expect from the shell, exactly?
by fuzzybear3965 5y ago
Shells return exit codes, not typed error values. What kind of output would you expect from the shell, exactly?
- nerdponx 5y agoStatus 129 or something else outside the usual range, plus a message that the file was not a valid ELF and also has no shebang, therefore cannot be executed.
- fuzzybear3965 5y agoI always thought that 128+ are for (shell-spawned) processes and 0-127 are for shell. But, apparently POSIX requires this behavior for empty files - we need to amend the standard, first (or fail to comply, muahahaha).
- deathanatos 5y agoI'd expect the same as any other failure from execv(2). Something like, zsh: Exec format error: empty-file (last command returned 127.) (127 is the exit status for other failures, so I've used it here. The second line is intended to be part of my PS1, the first zsh's normal reporting. The string used here is what I get from perror() for that code.)
- fuzzybear3965 5y agoOkay, yeah. That could be useful. Seems POSIX forces the behavior described in the blog post. Time to change the standard!