Skip to content

Commit 7a54085

Browse files
committed
Rename ReadProcessException constructor to ProcessFailed
The `ReadProcessException` constructor of the type with the same name suggested that it is the only constructor of that type. Renaming it fixes that.
1 parent 6906701 commit 7a54085

7 files changed

Lines changed: 14 additions & 13 deletions

File tree

src/Stack/Build/Execute.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ singleBuild runInBase ac@ActionContext {..} ee@ExecuteEnv {..} task@Task {..} in
10931093
, packageIdentifierString taskProvides
10941094
])
10951095
(\ex -> case ex of
1096-
ReadProcessException{} -> return ()
1096+
ProcessFailed{} -> return ()
10971097
_ -> throwM ex)
10981098

10991099
readProcessNull Nothing menv' ghcPkgExe

src/Stack/Config.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ resolvePackageLocation menv projRoot (PLRemote url remotePackageType) = do
599599
return dir
600600
where
601601
handleError = handle $ \case
602-
ReadProcessException{} -> do
602+
ProcessFailed{} -> do
603603
$logInfo $ "Failed to reset to commit " <> commit <> ", deleting and re-cloning."
604604
ignoringAbsence (removeDirRecur dir)
605605
doClone
@@ -621,7 +621,7 @@ resolvePackageLocation menv projRoot (PLRemote url remotePackageType) = do
621621
readProcessNull (Just dir) menv commandName
622622
(resetCommand ++ [T.unpack commit, "--"])
623623
`catch` \case
624-
ex@ReadProcessException{} -> do
624+
ex@ProcessFailed{} -> do
625625
unless firstTry $ $logInfo $
626626
"Please ensure that commit " <> commit <> " exists within " <> url
627627
throwM ex

src/Stack/Docker.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ cleanup opts =
481481
| otherwise -> throwM (InvalidCleanupCommandException line)
482482
e <- try (readDockerProcess envOverride args)
483483
case e of
484-
Left ex@ReadProcessException{} ->
484+
Left ex@ProcessFailed{} ->
485485
$logError (concatT ["Could not remove: '",v,"': ", show ex])
486486
Left e' -> throwM e'
487487
Right _ -> return ()
@@ -662,7 +662,7 @@ inspects envOverride images =
662662
case eitherDecode (LBS.pack (filter isAscii (decodeUtf8 inspectOut))) of
663663
Left msg -> throwM (InvalidInspectOutputException msg)
664664
Right results -> return (Map.fromList (map (\r -> (iiId r,r)) results))
665-
Left (ReadProcessException _ _ _ err)
665+
Left (ProcessFailed _ _ _ err)
666666
| "Error: No such image" `LBS.isPrefixOf` err -> return Map.empty
667667
Left e -> throwM e
668668

src/Stack/PackageIndex.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ updateIndexGit menv indexName' index gitUrl = do
255255
$logWarn "Shallow package index repo detected, transitioning to a full clone..."
256256
let handleUnshallowError =
257257
C.handle $ \case
258-
ReadProcessException{} -> do
258+
ProcessFailed{} -> do
259259
$logInfo $ "Failed to convert to full clone, deleting and re-cloning."
260260
ignoringAbsence (removeDirRecur acfDir)
261261
doClone
@@ -280,7 +280,7 @@ updateIndexGit menv indexName' index gitUrl = do
280280
Left ex -> do
281281
$logError (T.pack (show ex))
282282
case ex of
283-
ReadProcessException{} -> $logError $ T.unlines
283+
ProcessFailed{} -> $logError $ T.unlines
284284
["Signature verification failed. "
285285
,"Please ensure you've set up your"
286286
,"GPG keychain to accept the D6CF60FD signing key."

src/Stack/Setup.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,9 +1110,9 @@ ensureGhcjsBooted menv cv shouldBoot = do
11101110
eres <- try $ sinkProcessStdout Nothing menv "ghcjs" [] (return ())
11111111
case eres of
11121112
Right () -> return ()
1113-
Left (ReadProcessException _ _ _ err) | "no input files" `S.isInfixOf` LBS.toStrict err ->
1113+
Left (ProcessFailed _ _ _ err) | "no input files" `S.isInfixOf` LBS.toStrict err ->
11141114
return ()
1115-
Left (ReadProcessException _ _ _ err) | "ghcjs_boot.completed" `S.isInfixOf` LBS.toStrict err ->
1115+
Left (ProcessFailed _ _ _ err) | "ghcjs_boot.completed" `S.isInfixOf` LBS.toStrict err ->
11161116
if not shouldBoot then throwM GHCJSNotBooted else do
11171117
config <- asks getConfig
11181118
destDir <- installDir (configLocalPrograms config) (ToolGhcjs cv)

src/Stack/Solver.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ cabalSolver menv cabalfps constraintType
130130

131131
catch (liftM Right (readProcessStdout (Just tmpdir) menv "cabal" args))
132132
(\ex -> case ex of
133-
ReadProcessException _ _ _ err -> return $ Left err
133+
ProcessFailed _ _ _ err -> return $ Left err
134134
_ -> throwM ex)
135135
>>= either parseCabalErrors parseCabalOutput
136136

src/System/Process/Read.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,14 @@ readProcessStderrStdout wd menv name args = do
207207

208208
-- | An exception while trying to read from process.
209209
data ReadProcessException
210-
= ReadProcessException CreateProcess ExitCode L.ByteString L.ByteString
210+
= ProcessFailed CreateProcess ExitCode L.ByteString L.ByteString
211+
-- ^ @'ProcessFailed' createProcess exitCode stdout stderr@
211212
| NoPathFound
212213
| ExecutableNotFound String [FilePath]
213214
| ExecutableNotFoundAt FilePath
214215
deriving Typeable
215216
instance Show ReadProcessException where
216-
show (ReadProcessException cp ec out err) = concat $
217+
show (ProcessFailed cp ec out err) = concat $
217218
[ "Running "
218219
, showSpec $ cmdspec cp] ++
219220
maybe [] (\x -> [" in directory ", x]) (cwd cp) ++
@@ -271,7 +272,7 @@ sinkProcessStdout wd menv name args sinkStdout = do
271272
(\(ProcessExitedUnsuccessfully cp ec) ->
272273
do stderrBuilder <- liftIO (readIORef stderrBuffer)
273274
stdoutBuilder <- liftIO (readIORef stdoutBuffer)
274-
throwM $ ReadProcessException
275+
throwM $ ProcessFailed
275276
cp
276277
ec
277278
(toLazyByteString stdoutBuilder)

0 commit comments

Comments
 (0)