calling system gives exception, waitForProcess

Simon Marlow simonmar at microsoft.com
Mon Dec 5 09:50:37 EST 2005


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


More information about the Glasgow-haskell-users mailing list