-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SOMETIMES readProcessStderr returns an empty string ignoring the output of the child #32
Comments
On MacOS 10.15.4, |
It wasn't reproduced also on my Debian 10 VM. |
Can you try compiling with the multithreaded runtime instead? And does this occur with readProcess? |
Unfortunately, > stack --resolver=lts-16.1 ghc --package typed-process -- -threaded repro.hs
[1 of 1] Compiling Main ( repro.hs, repro.o )
Linking repro.exe ...
> .\repro.exe
.
.
.
.
.
.
.
.
.
.
.
.
.
.
repro.exe: user error (Reproduced!) |
And found repro-readProcess.hs: {-# LANGUAGE OverloadedStrings #-}
import Control.Monad
import qualified Data.ByteString.Lazy as BL
import qualified Data.ByteString as B
import System.Exit
import System.IO
import System.Process.Typed
main :: IO ()
main = do
hSetBuffering stdout NoBuffering
replicateM_ 300 $ do
(CommandResult _ _out err) <- runCommand
if err == ""
then fail "Reproduced!"
else putStrLn "."
data CommandResult =
CommandResult
!ExitCode
!B.ByteString
!B.ByteString
deriving Show
runCommand :: IO CommandResult
runCommand = do
let prc = setStdin (byteStringInput "bbbbb\nbbbbbbbbbddd\nccc\nkjkjk\ndafadfae\n\np\n")
$ proc "./example" []
(ecode, out, err) <- readProcess prc
return $ CommandResult ecode (BL.toStrict out) (BL.toStrict err)
|
One point more: Deleting all |
I don't really have any thoughts on what may be causing this, sorry. |
UPDATE:
.\example.exe
with./example
in repro.hs for easier testing on other OSs.Minimum code to reproduce
I'm not sure this is really the smallest code, but these reproduce the error relatively more often.
example.hs:
repro.hs:
Steps to reproduce
Expected result
stack --resolver=lts-16.1 runghc repro.hs
should print only.
, without any error.Actual result
stack --resolver=lts-16.1 runghc repro.hs
exits with an error after running the command several times.For example:
NOTE
Sometimes the error is not reproduced even after running 300 times.
My environment
Windows 10 Pro ver. 1809
The text was updated successfully, but these errors were encountered: