runInteractiveCommand/Process docs don't mention if handles are text or binary
runInteractiveCommand
and runInteractiveProcess
return newly created Handle
s. The haddock documentation for these actions does not specify if the Handle
s are opened in text or binary mode.
This caused at least one real-world bug where Cabal reads the output of ghc-pkg describe *
, parsing it by splitting into lines. The standard haskell lines
function splits on '\n' characters so we ended up with trailing '\r' characters. This was almost certainly because ghc-pkg
was writing to stdout in text mode but Cabal was reading from the pipe in binary mode, presumably because currently runInteractiveCommand
uses binary mode.
We probably don't want to have two versions of the functions so perhaps the documentation should specify what it does now and mention hSetBinaryMode
for people who want to use that.
Trac metadata
Trac field | Value |
---|---|
Version | 6.8.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/process |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |