Skip to content

Commit e7df61a

Browse files
committed
Change dirtiness checking for commercialhaskell#822
1 parent b763b0e commit e7df61a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/Stack/FileWatch.hs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,17 @@ fileWatch inner = withManager $ \manager -> do
9696
atomically $ do
9797
dirty <- readTVar dirtyVar
9898
check dirty
99-
writeTVar dirtyVar False
10099

101100
eres <- tryAny $ inner setWatched
101+
102+
-- Clear dirtiness flag after the build to avoid an infinite
103+
-- loop caused by the build itself triggering dirtiness. This
104+
-- could be viewed as a bug, since files changed during the
105+
-- build will not trigger an extra rebuild, but overall seems
106+
-- like better behavior. See
107+
-- https://github.com/commercialhaskell/stack/issues/822
108+
atomically $ writeTVar dirtyVar False
109+
102110
case eres of
103111
Left e -> printExceptionStderr e
104112
Right () -> putStrLn "Success! Waiting for next file change."

0 commit comments

Comments
 (0)