Re: [Haskell-cafe] runInteractiveCommand: program ends before writing or reading all the output

2008-05-16 Thread Duncan Coutts
On Thu, 2008-05-15 at 21:04 -0400, Olivier Boudry wrote: I tried to place a length text `seq` before the mapM_ writeExport to force the process output to be read but the result was even worst (only one line printed). Apparently withtout the `evaluate` function it causes more troubles than it

Re: [Haskell-cafe] runInteractiveCommand: program ends before writing or reading all the output

2008-05-15 Thread Philip Weaver
2008/5/15 Olivier Boudry [EMAIL PROTECTED]: Hi all, It's the first time I use the runInteractiveCommand and I was probably bitten by laziness. When I run the following program and send its output to a file using '' redirection I get the full output of the called process. But if I run it in

Re: [Haskell-cafe] runInteractiveCommand: program ends before writing or reading all the output

2008-05-15 Thread Ronald Guida
It looks like a simple race condition to me. You are using waitForProcess pid to wait for runInteractiveCommand to finish, but you don't seem to have anything that waits for createDefFile to finish. main :: IO () main = do (file:_) - getArgs (_, out, _, pid) - runInteractiveCommand $

Re: [Haskell-cafe] runInteractiveCommand: program ends before writing or reading all the output

2008-05-15 Thread Philip Weaver
On Thu, May 15, 2008 at 11:42 AM, Ronald Guida [EMAIL PROTECTED] wrote: It looks like a simple race condition to me. You are using waitForProcess pid to wait for runInteractiveCommand to finish, but you don't seem to have anything that waits for createDefFile to finish. Whoops, sorry, I

Re: [Haskell-cafe] runInteractiveCommand: program ends before writing or reading all the output

2008-05-15 Thread Olivier Boudry
On Thu, May 15, 2008 at 2:42 PM, Ronald Guida [EMAIL PROTECTED] wrote: It looks like a simple race condition to me. You are using waitForProcess pid to wait for runInteractiveCommand to finish, but you don't seem to have anything that waits for createDefFile to finish. Thanks Ronald, As I

Re[2]: [Haskell-cafe] runInteractiveCommand: program ends before writing or reading all the output

2008-05-15 Thread Bulat Ziganshin
Hello Olivier, Thursday, May 15, 2008, 11:06:19 PM, you wrote: As I could not find a function to wait on a ThreadId I used a MVar to synchronize both threads. Is this normal or have I missed the `waitOnThreadId` function? yes, it's common idiom -- Best regards, Bulat

Re: [Haskell-cafe] runInteractiveCommand: program ends before writing or reading all the output

2008-05-15 Thread Duncan Coutts
On Thu, 2008-05-15 at 13:40 -0400, Olivier Boudry wrote: Hi all, It's the first time I use the runInteractiveCommand and I was probably bitten by laziness. Yes. I think Philip diagnosed the problem correctly. As an example let me show you as an example how we use it in Cabal:

Re: [Haskell-cafe] runInteractiveCommand: program ends before writing or reading all the output

2008-05-15 Thread Olivier Boudry
On Thu, May 15, 2008 at 6:23 PM, Duncan Coutts [EMAIL PROTECTED] wrote: On Thu, 2008-05-15 at 13:40 -0400, Olivier Boudry wrote: As an example let me show you as an example how we use it in Cabal: Hi Duncan, I tried to place a length text `seq` before the mapM_ writeExport to force the