on master help sign in
Proper utf-8 decoding
commitfedb73a665b5adb23cfe09cfee5cde522035bf72 authoriko <ilyakooo0@gmail.com> dateMon 24 Feb 2020, 21:02 (7 years ago) parent6ef5730
2 files changed+6−5
package.yaml+1 src/Data/Tasks/Build.hs+5−5
package.yaml+1
@@ -52,6 +52,7 @@ library:
5252 - transformers
5353 - cassava
5454 - http-media
55+ - utf8-string
5556
5657executables:
5758 sc-build-exe:
src/Data/Tasks/Build.hs+5−5
@@ -16,7 +16,7 @@ import Control.Monad.IO.Unlift
1616import Control.Task
1717import Data.Aeson hiding (Success)
1818import qualified Data.ByteString.Lazy.Char8 as BS
19−import Data.Char
19+import qualified Data.ByteString.Lazy.UTF8 as BS
2020import Data.String
2121import Data.Submission
2222import Data.Submission.Query
@@ -55,7 +55,7 @@ instance Task Build "build-repo" where
5555 (shellCode, _, shellErr) <- readProcess . setWorkingDir dir $ shell preProcessShell
5656 case shellCode of
5757 ExitFailure n -> do
58− let err = BS.unpack shellErr
58+ let err = BS.toString shellErr
5959 logError . T.pack $
6060 "preprocessing command for repo " <> show fullRepoName <> " at sha "
6161 <> show sha
@@ -129,7 +129,7 @@ instance Task Build "build-repo" where
129129 return (buildCode, buildOut, buildErr)
130130 case dockerRes of
131131 (ExitFailure n, _, buildErr) -> do
132− let err = filter (\c -> isPrint c || isSpace c) . BS.unpack $ buildErr
132+ let err = BS.toString buildErr
133133 logError . T.pack $
134134 "test command for repo " <> show fullRepoName <> " at sha "
135135 <> show sha
@@ -142,7 +142,7 @@ instance Task Build "build-repo" where
142142 (ExitSuccess, buildOut, _) ->
143143 case eitherDecode' (BS.dropWhile (/= '{') buildOut) of
144144 Left err' -> do
145− let err = err' <> " " <> BS.unpack buildOut
145+ let err = err' <> " " <> BS.toString buildOut
146146 logError . T.pack $
147147 "could not decode test result from repo " <> show fullRepoName
148148 <> " at sha "
@@ -150,7 +150,7 @@ instance Task Build "build-repo" where
150150 <> ": "
151151 <> err
152152 scheduleFailedStatus err owner repoName sha
153− updateSubmissionStatus fullRepoName sha' (SubmissionFailed (err <> BS.unpack buildOut))
153+ updateSubmissionStatus fullRepoName sha' (SubmissionFailed (err <> BS.toString buildOut))
154154 Right testResult@TestResult {..} -> do
155155 scheduleTestedStatus testResult owner repoName sha
156156 updateSubmissionStatus fullRepoName sha' (SubmissionRun testResult)