diff --git a/ChangeLog.md b/ChangeLog.md index 3d8d21d5b8..ccea38047c 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -14,6 +14,10 @@ Other enhancements: Bug fixes: +* `stack build` with `--file-watch` or `--file-watch-poll` outputs 'pretty' + error messages, as intended. See + [#5978](https://github.com/commercialhaskell/stack/issues/5978). + ## v2.9.3 Release notes: diff --git a/src/Stack/FileWatch.hs b/src/Stack/FileWatch.hs index 0d4813011e..02fc574c85 100644 --- a/src/Stack/FileWatch.hs +++ b/src/Stack/FileWatch.hs @@ -125,13 +125,14 @@ fileWatchConf cfg inner = -- https://github.com/commercialhaskell/stack/issues/822 atomically $ writeTVar dirtyVar False - prettyInfo $ - case eres of - Left e -> - let theStyle = case fromException e of - Just ExitSuccess -> Good - _ -> Error - in style theStyle $ fromString $ displayException e - _ -> style Good "Success! Waiting for next file change." + case eres of + Left e -> + case fromException e of + Just ExitSuccess -> + prettyInfo $ style Good $ fromString $ displayException e + _ -> case fromException e :: Maybe PrettyException of + Just pe -> prettyError $ pretty pe + _ -> prettyInfo $ style Error $ fromString $ displayException e + _ -> prettyInfo $ style Good "Success! Waiting for next file change." logInfo "Type help for available commands. Press enter to force a rebuild."