Skip to content
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

watchTree* and creating new subdirectories #67

Closed
sgraf812 opened this issue Oct 21, 2016 · 0 comments · Fixed by #73
Closed

watchTree* and creating new subdirectories #67

sgraf812 opened this issue Oct 21, 2016 · 0 comments · Fixed by #73

Comments

@sgraf812
Copy link

New subdirectories aren't immediately watched:

#!/usr/bin/env stack
-- stack --resolver lts-7.4 --install-ghc runghc --package fsnotify --package directory --package temporary

import Control.Concurrent
import System.FSNotify
import System.FilePath
import System.Directory
import System.IO.Temp

main = 
  withSystemTempDirectory "fsnotify" $ \baseDir -> 
  withManager $ \mgr -> do
    _ <- watchTree mgr baseDir (const True) print
    writeFile (baseDir </> "file.txt") "whuzza"
    let childDir = baseDir </> "child"
    createDirectoryIfMissing True childDir
    -- threadDelay (10*1000)
    writeFile (childDir </> "child.txt") "whoop"
    threadDelay (1000*1000)

This prints only one line, instead of the expected two when that line is uncommented.

Also, this works as expected on OS X, but not on my Linux VM.

sgraf812 added a commit to sgraf812/feed-gipeda that referenced this issue Oct 21, 2016
For fresh projects, fsnotify isn't picking up file changes in recursive
mode in newly created subdirs
(haskell-fswatch/hfsnotify#67), so we have to
wait a millisecond after creating subdirs before writing the file.
Also I hope that this will fix #11.
thomasjm added a commit that referenced this issue May 4, 2018
Big refactors and breaking API change.
- Fixes #71 
- Fixes #62
- Fixes #67 (checked by hand)
- Fixes #69 
- Fixes #66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant