@@ -23,9 +23,11 @@ import Control.Concurrent.Async (async)
23
23
import Control.Concurrent.STM (newEmptyTMVarIO , atomically , putTMVar , readTMVar , STM , tryPutTMVar , throwSTM )
24
24
import System.Exit (ExitCode )
25
25
import qualified Data.ByteString.Lazy as L
26
- import qualified Data.ByteString.Lazy.Char8 as L8
27
26
import Data.String (IsString (fromString ))
28
27
import Control.Monad.IO.Unlift
28
+ import qualified Data.Text.Encoding.Error as TEE
29
+ import qualified Data.Text.Lazy as TL
30
+ import qualified Data.Text.Lazy.Encoding as TLE
29
31
30
32
#if MIN_VERSION_process(1, 4, 0) && !WINDOWS
31
33
import System.Posix.Types (GroupID , UserID )
@@ -620,11 +622,13 @@ instance Show ExitCodeException where
620
622
, show (eceProcessConfig ece) { pcEnv = Nothing }
621
623
, if L. null (eceStdout ece)
622
624
then " "
623
- else " Standard output:\n\n " ++ L8. unpack (eceStdout ece)
625
+ else " Standard output:\n\n " ++ unpack (eceStdout ece)
624
626
, if L. null (eceStderr ece)
625
627
then " "
626
- else " Standard error:\n\n " ++ L8. unpack (eceStderr ece)
628
+ else " Standard error:\n\n " ++ unpack (eceStderr ece)
627
629
]
630
+ where
631
+ unpack = TL. unpack . TLE. decodeUtf8With TEE. lenientDecode
628
632
629
633
-- | Wrapper for when an exception is thrown when reading from a child
630
634
-- process, used by 'byteStringOutput'.
0 commit comments