On 22 August 2006 10:08, Esa Ilari Vuokko wrote:
> Simon Marlow wrote:
>>> New patches:
>>>
>>> [Enable timeout in Windows and don't require cygwin python
>>> Esa Ilari Vuokko <[EMAIL PROTECTED]>**20060821192118] {
>>> hunk ./driver/testlib.py 1003
>>> - return os.system( cmd )
>>> + r = os.spawnl(os.P_WAIT, config.timeout_prog, +
>>> config.timeout_prog,`config.timeout`,'"%s"'%cmd )
>>> + return r << 8
>>> hunk ./timeout/timeout.hs 84
>>> - forkIO (do p <- runCommand cmd
>>> + forkIO (do p <- runCommand $ "sh -c \"" ++ cmd ++ "\""
>>
>> This looks strange to me: runCommand already runs the command using
>> the shell, so you appear to have added another shell layer. Why is
>> this necessary? If it's needed for some reason, perhaps add a
>> comment to explain?
>
> Because ghc is and builds native Windows programs, it uses cmd as
> shell. We need sh, which should be in path because the program is ran
> under
> sh from either msys or cygwin.
>
> I'll post patch with more/better comments later.
Then I suggest using runProcess rather than runCommand, because the
cmd.exe layer is redundant. If you just need to find sh on the PATH,
then use findExecutable.
Cheers,
Simon