Skip to content

Commit c975c84

Browse files
committed
solver: parse cabal errors also on Windows
Noticed on #2502. Basically, `isSuffixOf "suffix" "stuff suffix\r"` is spuriously false, so we should better strip `\r`. I've not yet verified that `\r` is actually there; I infer it from the presence of `stripCR` and the parse failure. Time to test this.
1 parent 0b35c49 commit c975c84

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Stack/Solver.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ cabalSolver menv cabalfps constraintType
136136

137137
where
138138
errCheck = T.isInfixOf "Could not resolve dependencies"
139+
linesNoCR = map stripCR . T.lines
139140
cabalBuildErrMsg e =
140141
">>>> Cabal errors begin\n"
141142
<> e
@@ -167,7 +168,7 @@ cabalSolver menv cabalfps constraintType
167168
else errExit msg
168169

169170
parseConflictingPkgs msg =
170-
let ls = dropWhile (not . errCheck) $ T.lines msg
171+
let ls = dropWhile (not . errCheck) $ linesNoCR msg
171172
select s = ((T.isPrefixOf "trying:" s)
172173
|| (T.isPrefixOf "next goal:" s))
173174
&& (T.isSuffixOf "(user goal)" s)
@@ -180,8 +181,7 @@ cabalSolver menv cabalfps constraintType
180181
parseCabalOutput bs = do
181182
let ls = drop 1
182183
$ dropWhile (not . T.isPrefixOf "In order, ")
183-
$ map stripCR
184-
$ T.lines
184+
$ linesNoCR
185185
$ decodeUtf8 bs
186186
(errs, pairs) = partitionEithers $ map parseCabalOutputLine ls
187187
if null errs

0 commit comments

Comments
 (0)