ndmitchell / ghcid

Very low feature GHCi based IDE
Other
1.13k stars 114 forks source link

Passing a directory to --restart behaves like passing the directory to --reload #273

Closed nfrisby closed 4 years ago

nfrisby commented 5 years ago

My OS: Debian 9.

When I change a file under a directory passed to --restart, ghcid should restart but instead only reloads. Some details below.

56 allows --restart to accept directories, by expanding any directories "just in time" during the check. Note how files is locally redefined by expanding any directory names in it.

https://github.com/ndmitchell/ghcid/blob/17775959407125814f782ba39751112e8c956ed9/src/Wait.hs#L63-L64

However, the logic in the main loop only restarts if the original argument to --restart has a newer modification time. Otherwise it just reloads. On my OS, changing a file's mtime does not change all of its ancestory directories' mtime -- that's why the logic currently on master is misbehaving in this case.

https://github.com/ndmitchell/ghcid/blob/17775959407125814f782ba39751112e8c956ed9/src/Ghcid.hs#L372-L375