From 109971d74c01c9522accfbdb394bc38d8b60acf0 Mon Sep 17 00:00:00 2001 From: voidlizard Date: Thu, 10 Oct 2024 11:59:26 +0300 Subject: [PATCH] fixed fixme-new wtf with lazy io --- fixme-new/lib/Fixme/Run/Internal.hs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/fixme-new/lib/Fixme/Run/Internal.hs b/fixme-new/lib/Fixme/Run/Internal.hs index e43f8857..f28553ce 100644 --- a/fixme-new/lib/Fixme/Run/Internal.hs +++ b/fixme-new/lib/Fixme/Run/Internal.hs @@ -365,22 +365,23 @@ Issue text... flip runContT pure $ callCC \exit -> do fname <- liftIO $ Temp.writeTempFile "." "fixme-issue" txt - h1 <- liftIO $ try @_ @SomeException (LBS.readFile fname) - <&> fromRight mempty + ContT $ bracket none (const $ rm fname) + + h1 <- liftIO (BS.readFile fname) <&> hashObject @HbSync - ContT $ bracket none (const $ rm fname) + debug $ "hash1" <+> pretty h1 void $ runProcess $ shell [qc|{editor} {fname}|] - s <- liftIO $ LBS.readFile fname + s <- liftIO $ BS.readFile fname <&> LBS.fromStrict - h2 <- liftIO $ try @_ @SomeException (LBS.readFile fname) - <&> fromRight mempty - <&> hashObject @HbSync + let h2 = hashObject @HbSync s fxs <- lift $ scanBlobOpts NoIndents Nothing s + debug $ "hash before/after" <+> pretty h1 <+> pretty h2 + when (h1 == h2) $ exit () lift $ withState $ transactional do