Fix external sub-process runners to use line buffering
Previously the internal `system`/`systemStrict`/`stream` utilities were using block buffering of the external process' standard input, which made them more difficult to use interactively within `ghci`.
This commit is contained in:
parent
89d9e5e569
commit
c30e41b00d
1 changed files with 3 additions and 0 deletions
|
@ -355,6 +355,7 @@ system p s = liftIO (do
|
||||||
|
|
||||||
let open = do
|
let open = do
|
||||||
(Just hIn, Nothing, Nothing, ph) <- Process.createProcess p'
|
(Just hIn, Nothing, Nothing, ph) <- Process.createProcess p'
|
||||||
|
IO.hSetBuffering hIn IO.LineBuffering
|
||||||
return (hIn, ph)
|
return (hIn, ph)
|
||||||
|
|
||||||
-- Prevent double close
|
-- Prevent double close
|
||||||
|
@ -389,6 +390,7 @@ systemStrict p s = liftIO (do
|
||||||
|
|
||||||
let open = do
|
let open = do
|
||||||
(Just hIn, Just hOut, Nothing, ph) <- liftIO (Process.createProcess p')
|
(Just hIn, Just hOut, Nothing, ph) <- liftIO (Process.createProcess p')
|
||||||
|
IO.hSetBuffering hIn IO.LineBuffering
|
||||||
return (hIn, hOut, ph)
|
return (hIn, hOut, ph)
|
||||||
|
|
||||||
-- Prevent double close
|
-- Prevent double close
|
||||||
|
@ -456,6 +458,7 @@ stream p s = do
|
||||||
|
|
||||||
let open = do
|
let open = do
|
||||||
(Just hIn, Just hOut, Nothing, ph) <- liftIO (Process.createProcess p')
|
(Just hIn, Just hOut, Nothing, ph) <- liftIO (Process.createProcess p')
|
||||||
|
IO.hSetBuffering hIn IO.LineBuffering
|
||||||
return (hIn, hOut, ph)
|
return (hIn, hOut, ph)
|
||||||
|
|
||||||
-- Prevent double close
|
-- Prevent double close
|
||||||
|
|
Loading…
Reference in a new issue