Skip to content

Commit

Permalink
Exit with non-zero exitcode if wrapper fails to launch (#4110)
Browse files Browse the repository at this point in the history
* Exit with non-zero exitcode if wrapper fails to launch

Only when in LSP mode, we want to launch the LSP server that offers the
restart capability.

* Install recommended GHC version for release wrapper tests

---------

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
  • Loading branch information
fendor and michaelpj authored Mar 3, 2024
1 parent 7ccdeb9 commit 2ec645d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ test_all_hls() {
fi
fi
done
# install the recommended GHC version so the wrapper can launch HLS
ghcup install ghc --set recommended
"$bindir/haskell-language-server-wrapper${ext}" typecheck "${test_module}" || fail "failed to typecheck with HLS wrapper"
}

Expand Down
6 changes: 4 additions & 2 deletions exe/Wrapper.hs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ main = do
Left err -> do
T.hPutStrLn stderr (prettyError err NoShorten)
case args of
Ghcide _ -> launchErrorLSP recorder (prettyError err Shorten)
_ -> pure ()
Ghcide (GhcideArguments { argsCommand = Main.LSP }) ->
launchErrorLSP recorder (prettyError err Shorten)

_ -> exitFailure

launchHaskellLanguageServer :: Recorder (WithPriority (Doc ())) -> Arguments -> IO (Either WrapperSetupError ())
launchHaskellLanguageServer recorder parsedArgs = do
Expand Down

0 comments on commit 2ec645d

Please sign in to comment.