Closed smoelius closed 1 year ago
Heh, that's a fun one! The core issue here is that running commands requires touching two file-system paths:
So, when we spawn a command and get a NotFound, it can mean either:
and, as far as I can tell, there's no way for us to tell which one was that precisely. I think it makes sense to heuristically detect this case: if spawning a command failed, check if the directory exist and, if it does not, emit a message like the following:
Error: working directory `/bla/bla/bla` does not exist.
This of course is TOCTOU, but better than the status quo.
I tried this code:
And I saw this:
IMHO, the error message should indicate that the current directory does not exist, rather than say "command not found".
Really nice tool, BTW.