Skip to content
  • Zejun Wu's avatar
    Fix sdist output when sent to stdout (#5874) · 6ba7207b
    Zejun Wu authored
    This was broken by 7a029caa
    
    We can not use `ByteString.pack` and then print it as `String`, which
    will get encoded again based on the system setting, and very likely,
    we get different things unless the encoding is something like ISO-8859-1, e.g.
    in UTF-8 environment, the magic of gz "\x1f\x8b" will get encoded again
    into "\x1f\xc2\x8b".
    
    Before:
    
    ```
    $ /cabal sdist --output-dir=- | tar -t -z -f -
    tar: This does not look like a tar archive
    ```
    
    And now:
    
    ```
    $ cabal sdist --output-dir=- | tar -t -z -f -  | tail -n 1
    cabal-install-2.5.0.0/tests/README.md
    ```
    6ba7207b