File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,8 @@ Bug fixes:
7676* ` stack upload ` no longer reveals your password when you type it on
7777 MinTTY-based Windows shells, such as Cygwin and MSYS2.
7878 See [ #3142 ] ( https://github.com/commercialhaskell/stack/issues/3142 )
79+ * ` stack script ` 's import parser will now properly parse files that
80+ have Windows-style line endings (CRLF)
7981
8082
8183## 1.4.0
Original file line number Diff line number Diff line change @@ -266,8 +266,15 @@ loadModuleInfo name = do
266266
267267parseImports :: ByteString -> (Set PackageName , Set ModuleName )
268268parseImports =
269- fold . mapMaybe parseLine . S8. lines
269+ fold . mapMaybe ( parseLine . stripCR) . S8. lines
270270 where
271+ -- Remove any carriage return character present at the end, to
272+ -- support Windows-style line endings (CRLF)
273+ stripCR bs
274+ | S8. null bs = bs
275+ | S8. last bs == ' \r ' = S8. init bs
276+ | otherwise = bs
277+
271278 stripPrefix x y
272279 | x `S8.isPrefixOf` y = Just $ S8. drop (S8. length x) y
273280 | otherwise = Nothing
You can’t perform that action at this time.
0 commit comments