Closed
Description
First consider runProcess_
, which behaves well. It inherits stdin and stdout and therefore avoids interfering in any encoding decisions. As long as the subprocess output encoding matches the terminal encoding all is good:
ghci> runProcess_ (shell "echo привет;echo 😑 1>&2 ; exit 1")
привет
😑
*** Exception: Received ExitFailure 1 when running
Shell command: echo привет;echo 😑 1>&2 ; exit 1
But readProcess_
does not behave well. On failure, it puts stdin and stdout into an ExitCodeException
. When it comes to call show
or displayException
it must choose an encoding to use, but it does not know which it should choose! Currently it uses decode :: ByteString -> String
, which is probably the worst of all worlds:
ghci> readProcess_ (shell "echo привет;echo 😑 1>&2 ; exit 1")
*** Exception: Received ExitFailure 1 when running
Shell command: echo привет;echo 😑 1>&2 ; exit 1
Standard output:
пÑивеÑ
Standard error:
ð
The output is completely garbled, and this is really bad for anyone working with non-ASCII.
Thanks to @9999years for bringing this to my attention in #83 (comment).
Metadata
Metadata
Assignees
Labels
No labels