-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error with RTS option --io-manager=native
in Pantry.Storage.initStorage
#59
Comments
migrates <- withWriteLock (display description) fp $ wrapMigrationFailure $
withSqliteConnInfo (sqinfo True) $ runSqlConn $
runMigrationSilent migration If that is changed to: migrates <- withWriteLock (display description) fp $ wrapMigrationFailure $
withSqliteConnInfo (sqinfo True) $ runSqlConn $ do
runMigration migration the issue disappears. Now, runMigrationSilent :: MonadUnliftIO m
=> Migration
-> ReaderT SqlBackend m [Text]
runMigrationSilent m = withRunInIO $ \run ->
hSilence [stderr] $ run $ runMigration' m True
mNullDevice :: Maybe FilePath
#ifdef WINDOWS
mNullDevice = Just "\\\\.\\NUL"
#elif UNIX
mNullDevice = Just "/dev/null"
#else
mNullDevice = Nothing
#endif
-- | Run an IO action while preventing all output to the given handles.
hSilence :: forall a. [Handle] -> IO a -> IO a
hSilence handles action =
case mNullDevice of
Just nullDevice ->
E.bracket (openFile nullDevice AppendMode)
hClose
prepareAndRun
Nothing -> withTempFile "silence" prepareAndRun
where
prepareAndRun :: Handle -> IO a
prepareAndRun tmpHandle = go handles
where
go [] = action
go (h:hs) = goBracket go tmpHandle h hs
goBracket :: ([Handle] -> IO a) -> Handle -> Handle -> [Handle] -> IO a
goBracket go tmpHandle h hs = do
buffering <- hGetBuffering h
let redirect = do
old <- hDuplicate h
hDuplicateTo tmpHandle h
return old
restore old = do
hDuplicateTo old h
hSetBuffering h buffering
hClose old
E.bracket redirect restore (\_ -> go hs) |
I think this is an upstream issue. See yesodweb/persistent#1423 and GHC issue #22146. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue first raised in Stack repository, see commercialhaskell/stack#5851. The suggested workaround in the exception message is not a workaround.
On Windows, the command
stack build +RTS --io-manager=native -RTS
results in the display of theMigrationFailure
PantryException
This is arising from the
Pantry.Storage.initStorage
(a wrapper aroundPantry.Storage.SQLite.initStorage
) inPantry.withPantryConfig
. (Stack useswithPantryConfig
inStack.Config.configFromConfigMonoid
.) I am still investigating.The text was updated successfully, but these errors were encountered: