on master help sign in
Proper utf-8 decoding
fedb73aiko
package.yaml+1
@@ -52,6 +52,7 @@ library:
52 - transformers
52 - transformers
53 - cassava
53 - cassava
54 - http-media
54 - http-media
55+ - utf8-string
55
56
56executables:
57executables:
57 sc-build-exe:
58 sc-build-exe:
src/Data/Tasks/Build.hs+5−5
@@ -16,7 +16,7 @@ import Control.Monad.IO.Unlift
16import Control.Task
16import Control.Task
17import Data.Aeson hiding (Success)
17import Data.Aeson hiding (Success)
18import qualified Data.ByteString.Lazy.Char8 as BS
18import qualified Data.ByteString.Lazy.Char8 as BS
19−import Data.Char
19+import qualified Data.ByteString.Lazy.UTF8 as BS
20import Data.String
20import Data.String
21import Data.Submission
21import Data.Submission
22import Data.Submission.Query
22import Data.Submission.Query
@@ -55,7 +55,7 @@ instance Task Build "build-repo" where
55 (shellCode, _, shellErr) <- readProcess . setWorkingDir dir $ shell preProcessShell
55 (shellCode, _, shellErr) <- readProcess . setWorkingDir dir $ shell preProcessShell
56 case shellCode of
56 case shellCode of
57 ExitFailure n -> do
57 ExitFailure n -> do
58− let err = BS.unpack shellErr
58+ let err = BS.toString shellErr
59 logError . T.pack $
59 logError . T.pack $
60 "preprocessing command for repo " <> show fullRepoName <> " at sha "
60 "preprocessing command for repo " <> show fullRepoName <> " at sha "
61 <> show sha
61 <> show sha
@@ -129,7 +129,7 @@ instance Task Build "build-repo" where
129 return (buildCode, buildOut, buildErr)
129 return (buildCode, buildOut, buildErr)
130 case dockerRes of
130 case dockerRes of
131 (ExitFailure n, _, buildErr) -> do
131 (ExitFailure n, _, buildErr) -> do
132− let err = filter (\c -> isPrint c || isSpace c) . BS.unpack $ buildErr
132+ let err = BS.toString buildErr
133 logError . T.pack $
133 logError . T.pack $
134 "test command for repo " <> show fullRepoName <> " at sha "
134 "test command for repo " <> show fullRepoName <> " at sha "
135 <> show sha
135 <> show sha
@@ -142,7 +142,7 @@ instance Task Build "build-repo" where
142 (ExitSuccess, buildOut, _) ->
142 (ExitSuccess, buildOut, _) ->
143 case eitherDecode' (BS.dropWhile (/= '{') buildOut) of
143 case eitherDecode' (BS.dropWhile (/= '{') buildOut) of
144 Left err' -> do
144 Left err' -> do
145− let err = err' <> " " <> BS.unpack buildOut
145+ let err = err' <> " " <> BS.toString buildOut
146 logError . T.pack $
146 logError . T.pack $
147 "could not decode test result from repo " <> show fullRepoName
147 "could not decode test result from repo " <> show fullRepoName
148 <> " at sha "
148 <> " at sha "
@@ -150,7 +150,7 @@ instance Task Build "build-repo" where
150 <> ": "
150 <> ": "
151 <> err
151 <> err
152 scheduleFailedStatus err owner repoName sha
152 scheduleFailedStatus err owner repoName sha
153− updateSubmissionStatus fullRepoName sha' (SubmissionFailed (err <> BS.unpack buildOut))
153+ updateSubmissionStatus fullRepoName sha' (SubmissionFailed (err <> BS.toString buildOut))
154 Right testResult@TestResult {..} -> do
154 Right testResult@TestResult {..} -> do
155 scheduleTestedStatus testResult owner repoName sha
155 scheduleTestedStatus testResult owner repoName sha
156 updateSubmissionStatus fullRepoName sha' (SubmissionRun testResult)
156 updateSubmissionStatus fullRepoName sha' (SubmissionRun testResult)