@@ -48,6 +48,7 @@ import Development.IDE.GHC.Compat hiding (Target,
48
48
TargetFile , TargetModule )
49
49
import qualified Development.IDE.GHC.Compat as GHC
50
50
import Development.IDE.GHC.Util
51
+ import Development.IDE.Graph (Action )
51
52
import Development.IDE.Session.VersionCheck
52
53
import Development.IDE.Types.Diagnostics
53
54
import Development.IDE.Types.Exports
@@ -56,7 +57,6 @@ import Development.IDE.Types.HscEnvEq (HscEnvEq, newHscEnvEq,
56
57
import Development.IDE.Types.Location
57
58
import Development.IDE.Types.Logger
58
59
import Development.IDE.Types.Options
59
- import Development.IDE.Graph (Action )
60
60
import GHC.Check
61
61
import qualified HIE.Bios as HieBios
62
62
import HIE.Bios.Environment hiding (getCacheDir )
@@ -152,8 +152,8 @@ setInitialDynFlags logger SessionLoadingOptions{..} = do
152
152
-- writing. Actions are picked off one by one from the `HieWriterChan` and executed in serial
153
153
-- by a worker thread using a dedicated database connection.
154
154
-- This is done in order to serialize writes to the database, or else SQLite becomes unhappy
155
- runWithDb :: FilePath -> (HieDb -> IndexQueue -> IO () ) -> IO ()
156
- runWithDb fp k = do
155
+ runWithDb :: Logger -> FilePath -> (HieDb -> IndexQueue -> IO () ) -> IO ()
156
+ runWithDb logger fp k = do
157
157
-- Delete the database if it has an incompatible schema version
158
158
withHieDb fp (const $ pure () )
159
159
`catch` \ IncompatibleSchemaVersion {} -> removeFile fp
@@ -171,9 +171,9 @@ runWithDb fp k = do
171
171
k <- atomically $ readTQueue chan
172
172
k db
173
173
`catch` \ e@ SQLError {} -> do
174
- hPutStrLn stderr $ " SQLite error in worker, ignoring: " ++ show e
174
+ logWarning logger $ " SQLite error in worker, ignoring: " <> T. pack( show e)
175
175
`catchAny` \ e -> do
176
- hPutStrLn stderr $ " Uncaught error in database worker, ignoring: " ++ show e
176
+ logWarning logger $ " Uncaught error in database worker, ignoring: " <> T. pack( show e)
177
177
178
178
179
179
getHieDbLoc :: FilePath -> IO FilePath
@@ -346,8 +346,8 @@ loadSessionWithOptions SessionLoadingOptions{..} dir = do
346
346
res <- loadDLL hscEnv " libm.so.6"
347
347
case res of
348
348
Nothing -> pure ()
349
- Just err -> hPutStrLn stderr $
350
- " Error dynamically loading libm.so.6:\n " <> err
349
+ Just err -> logError logger $
350
+ " Error dynamically loading libm.so.6:\n " <> T. pack err
351
351
352
352
-- Make a map from unit-id to DynFlags, this is used when trying to
353
353
-- resolve imports. (especially PackageImports)
0 commit comments