Open
Description
UPDATE:
- Modify the command to reproduce to make sure typed-process is installed.
- Replace
.\example.exe
with./example
in repro.hs for easier testing on other OSs. - Make example.hs and repro.hs smaller.
Minimum code to reproduce
I'm not sure this is really the smallest code, but these reproduce the error relatively more often.
example.hs:
main :: IO ()
main = do
_ <- getLine
fail "Invalid input!!"
repro.hs:
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad
import Control.Monad.IO.Class
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
replicateM_ 300 $ do
(CommandResult _ out) <- runCommand
if (out == "")
then fail "Reproduced!"
else putStrLn "."
data CommandResult =
CommandResult
!ExitCode
!B.ByteString
deriving Show
runCommand :: IO CommandResult
runCommand = do
let prc = setStdin (byteStringInput "\n")
$ proc "./example" []
(ecode, out) <- readProcessStderr prc
return . CommandResult ecode $ BL.toStrict out
Steps to reproduce
stack --resolver=lts-16.1 exec ghc example.hs
stack --resolver=lts-16.1 runghc --package typed-process repro.hs
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:
> stack --resolver=lts-16.1 runghc repro.hs
.
.
.
.
.
repro.hs: user error (Reproduced!)
NOTE
Sometimes the error is not reproduced even after running 300 times.
My environment
Windows 10 Pro ver. 1809
Metadata
Metadata
Assignees
Labels
No labels