I am making a program which shows stdout of my haskell program on UI.
I simply hooked it up with some text area, so I expected it to run normally other than potential crashes by mishaps.
However, I got
waitForProcess: does not exist (No child processes) on the child program.
Furthermore, the direct output of the child comes after the output of child of child.
To illustrate, let’s say the UI program spawned a (haskell) program A.
The program A spawns another program B through
Now, I expect the output like this:
A: Begin B: Begin (Further output of B) B: End A: End
and then program A should not emit
waitForProcess: does not exist (No child processes) unless something is messed up.
However, what I got is this:
B: Begin (Further output of B) B: End A: waitForProcess: does not exist (No child processes) A: Begin My UI Program: waitForProcess: does not exists (No child processes)
I’m sure that the part printing
A: Begin should be running, given that there is a noticeable pause (~1s) until
B: Begin is printed - likely when A starts running and calls the command.
Perhaps relevant: I inspect the
stdout line-by-line like this
actOnLine outp act = hIsEOF outp >>= \case True -> pure () False -> do line <- T.hGetLine outp T.putStrLn line act line actOnLine outp act
Which resides inside the bracket from
I am honestly lost on how to start debugging the problem. Would appreciate any idea on what is going on!