RE: calling system gives exception, waitForProcess

On 28 November 2005 23:16, Neil Mitchell wrote:
On Windows XP, with GHC 6.4.1, I get the following error consistently when calling "system", from the module System. I get this error on two entirely different computers, one slow (750Mhz) system, and one fast (3Ghz) system.
Its easiest to demonstrate when using GHCi, but the problem also occurs when running Haskell programs compiled with GHC.
Prelude System> system "yhi Main" PreludeList.!!: on empty list *** Exception: waitForProcess: does not exist (No such file or directory)
From a windows standard console, in the same current directory, I get: Windows> yhi Main PreludeList.!!: on empty list
When calling yhi using system in other circumstances (on other programs), it works fine. The "PreludeList.!! ..." text is being generated by the yhi program.
The yhi program is written in C, and is available from http://www.cs.york.ac.uk/~ndm/yhc/. Unfortunately this is probably a bit too large to use as a minimal test case, and takes quite a while to install/configure at the moment.
Any idea why the waitForProcess error is being raised?
I don't know why this is happening, sorry. waitForProcess does this: if (WaitForSingleObject((HANDLE) handle, INFINITE) == WAIT_OBJECT_0) { if (GetExitCodeProcess((HANDLE) handle, &retCode) == 0) { maperrno(); return -1; } return retCode; } So it seems that GetExitCodeProcess is returning ENOENT (or the Windows equivalent) for some reason. Could something else be calling GetExitCodeProcess() first? If you can find a smaller test case, I can probably look into it. Cheers, Simon

I have a fix for it now, thanks to dons. I just wrap system in Control.Exception.catch and it doesn't crash. dons also said that this has been fixed in head dons:
waitForProcess started raising exceptions if the processed had already termianted (I think) in 6.4.1 and the head. It's been fixed in the head.
Thanks Neil
participants (2)
-
Neil Mitchell
-
Simon Marlow