File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change
1
+ {-# LANGUAGE LambdaCase #-}
1
2
module Test.Hls
2
3
( module Test.Tasty.HUnit ,
3
4
module Test.Tasty ,
@@ -19,7 +20,7 @@ module Test.Hls
19
20
where
20
21
21
22
import Control.Applicative.Combinators
22
- import Control.Concurrent.Async (async , wait )
23
+ import Control.Concurrent.Async (async , cancel , wait )
23
24
import Control.Exception.Base
24
25
import Control.Monad.IO.Class
25
26
import Data.ByteString.Lazy (ByteString )
@@ -119,6 +120,7 @@ runSessionWithServer' plugin conf sconf caps root s = silenceStderr $ do
119
120
x <-
120
121
runSessionWithHandles inW outR sconf caps root s
121
122
`finally` setCurrentDirectory cwd
122
- wait server
123
- sleep 0.3
123
+ timeout 3 (wait server) >>= \ case
124
+ Just () -> pure ()
125
+ Nothing -> putStrLn " Server does not exit on time, canceling the async task..." >> cancel server
124
126
pure x
You can’t perform that action at this time.
0 commit comments