Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

unix/windows inconsistency of uv_spawn errors #865

Closed
oktal3700 opened this issue Jul 28, 2013 · 3 comments
Closed

unix/windows inconsistency of uv_spawn errors #865

oktal3700 opened this issue Jul 28, 2013 · 3 comments
Labels

Comments

@oktal3700
Copy link

On unix, uv_spawn always returns an error code if it failed to spawn the child process.

On windows, whether or not uv_spawn returns an error code on failure depends upon the cause of the failure: some kinds of failures return an error code, other kinds return zero (e.g. file not found). Therefore user code can continue in the belief that there was no error, when in fact there was an error. In these cases, the error is saved in spawn_error, which is a private field of uv_process_t, so user code needs to special-case its error handling on windows.

@bnoordhuis
Copy link
Contributor

/cc @piscisaureus

@piscisaureus
Copy link

@bnoordhuis Is it actually true that unix always returns the error immediately?
If I'm reading the code correctly, execve failure will set process->errno but uv_spawn will still return 0.

@bnoordhuis
Copy link
Contributor

Is it actually true that unix always returns the error immediately?

Only sometimes, when the call to fork() fails, for example.

piscisaureus added a commit that referenced this issue Aug 22, 2013
* It will now report some types of errors synchronously, to bring it
  on par with uv-unix. Fixes #865

* Failure to find the target executable will now set up stdio pipes
  correctly, so the user can assume that when uv_spawn() returns 0
  these pipes will never trigger asserts in libuv's guts.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants