inconsistent exception between unix/windows for running non-existant program
handle (print . isDoesNotExistError) $ do
(_,_,_,hnd) <- createProcess (proc "foobar" [])
print =<< waitForProcess hnd
On Windows this prints True
since it throws a "does not exists" kind of IOException. On Unix instead the createProcess call succeeds and then waiting on the process claims it terminated with an exit code of 127.
It is annoying that we need two different error handling mechanisms in this case. For example Cabal wants to know when it tries to run a program that cannot be found (eg when it tries to run sh.exe on Windows).
It would be better if the behaviour was consistent. The behaviour on Windows seems to be the more sensible one. We should be able to make the Unix behaviour the same since the exceve call does indeed return an error code when loading the new executable image fails.
Trac metadata
Trac field | Value |
---|---|
Version | 6.10.4 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/process |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |