fpco / replace-process

Replace the current process with a different executable
MIT License
3 stars 0 forks source link

Test suite failure on Windows #2

Open snoyberg opened 8 years ago

snoyberg commented 8 years ago

See: https://ci.appveyor.com/project/snoyberg/replace-process/build/1.0.6. In the test suite, we spawn a child process, which itself execs a grandchild process, which itself is supposed to exit with exit code 2. All of this works as expected on Linux and OS X, with the original process seeing an exit code of 2 from the child process. However, on Windows, we end up getting a successful exit code.

I ruled out the most obvious problem, that exitWith was somehow toying with me, by spawning the grandchild directly, but that returns an exit code of 2 (as expected). Somehow the exec in the middle is causing the problem.

mitchellwrosen commented 8 years ago

Could be a bug in _exec. Is the source available online?

Windows only emulates unix exec by forking a new process, waiting on it, and exiting. It should obviously exit with that process's exit code but it sounds like this might not be the case.

snoyberg commented 8 years ago

Interesting, it's news to me that _exec is just emulated. If that's the case, we may as well emulate it ourselves in Haskell using the process package (for Windows that is).

mitchellwrosen commented 8 years ago

Indeed, and remember all upcalls should be caught in the parent and delivered to the child (do signals even exist on Windows? heh)

I'd be really surprised if windows exec did not forward along the exit code of the new process, but I don't have a Windows machine to put together a test.

Edit: Well, not all signals, only those not thrown by the RTS. I think that's virtual timers and SIGUSR1.