-
Couldn't load subscription status.
- Fork 90
Frequently Asked Questions
John Feltz edited this page Jul 16, 2015
·
2 revisions
There is a several second delay before results appear when running runInteractiveCommand or similar with stdin. How do I eliminate this delay?
This can occur due to not terminating a process handle, or not closing a stdin handle after a call to a method such as runInteractiveCommand.
Consider:
(proc_in, proc_out, _, _) <- runInteractiveCommand "xargs ls -l"
hPutStr proc_in "/usr/local"
putStrLn =<< hGetContents proc_out
In this case, the solution is:
(proc_in, proc_out, _, h) <- runInteractiveCommand "xargs ls -l"
hPutStr proc_in "/usr/local"
hFlush proc_in
hClose proc_in
output <- hGetContents proc_out
waitForProcess h
putStrLn output