ndmitchell / ghcid

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

Reload blinking when running under stack #267

Closed cpennington closed 5 years ago

cpennington commented 5 years ago

When I run ghcid, it correctly spits out errors, but then ends up in a reloading loop with the message:

Reloading...
  Error when waiting, if this happens repeatedly, raise a ghcid bug.
  "/tmp/haskell-stack-ghci/7cdc9e7a/": can't watch what isn't there!: does not exist

This is with a .ghcid of --command "stack ghci yomi-engine:lib yomi-engine:exe:bootstrap". My stack configuration uses docker by default.

If I change the .ghcid to --command "stack ghci --no-docker yomi-engine:lib yomi-engine:exe:bootstrap", then ghcid fails, but after that, if I remove the --no-docker again, then ghcid runs with no reload loop.

ndmitchell commented 5 years ago

Can you paste the full output of --verbose in a gist (killing it a few times after the reload loop). My guess is that something tells ghcid about changes/errors in files that are immediately deleted and it gets super confused. The verbose output should let us figure out what.

cpennington commented 5 years ago

Hopefully this is enough: https://gist.github.com/cpennington/400a85f8e547c73bf81d4a3ec4b4b586

cpennington commented 5 years ago

I just realized that it's almost certainly an issue where stack is creating/reporting files in /tmp, which is inside the docker image. Running with --no-docker "fixes" the issue by creating a garbage local-disk version that the ghcid command running outside the container can find.

I think I might be able to fix it if I can tell stack to mount /tmp/haskell-stack-ghci into the container. Need to look at how to do that, though.

cpennington commented 5 years ago

Yes, I was able to mount that directory by using

docker:
  mount:
    - "/tmp/haskell-stack-ghci"

in my stack.yaml