When the argument list to an external command is too long (exceeds ARG_MAX), zsh returns exit status 127. This is incorrect because status 127 means the command was not found. POSIX says in "2.8.2 Exit Status for Commands": https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_02 | If a command is not found, the exit status shall be 127. If the | command name is found, but it is not an executable utility, the exit | status shall be 126. Now, the phrasing "it is not an executable utility" is a little vague, but the current versions of all other shells return 126 upon any failure to execute a utility that was found, so they seem to interpret that phrase as meaning "it could not be executed for whatever reason (other than 'not found')". In any case, 126 is better than any alternative, as all other exit codes potentially conflict with other meanings. Currently, the execute() function in Src/exec.c only returns status 126 if the error code is EACCES (permission denied) or ENOEXEC (exec format error). In all other cases, 127 is returned. That logic is not right, because 127 is the specific case: it is only to be used if the command was not found. Any failure to execute after the command is found should yield status 126. The attached patch changes that logic to return status 127 if there is no error number (which happens if a PATH search does not find a command) or if the error number is ENOENT (no such file or directory). In all other cases it now returns 126. I've also added a test for the "argument list too long" case. - Martijn -- modernish -- harness the shell https://github.com/modernish/modernish