Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: trapped in bash



Ray Andrews wrote on Sun, Dec 18, 2016 at 07:54:27 -0800:
> Would it be doable to distinguish between *really* 'not found' and
> 'can't run this binary'?  If nothing else it would have stopped me
> from having to ask that question :-/

As far as zsh is concerned, a binary file is simply something that can
be passed to execve().  zsh does not attempt to parse or load the file;
the C library and OS do.  So it is they who are in a position to issue
an error message explaining _why_ the file can't be executed.

I suppose you could write a command_not_found_handler() function that
tried to reverse engineer _why_ the command wasn't found — with the
obvious limitations, e.g., race conditions between the library's
execution and the handler's.

Cheers,

Daniel



Messages sorted by: Reverse Date, Date, Thread, Author