Skip to content

watch: ensure watch mode detects deleted and re-added files

In systems that don't support recursive file watching, If you watch a file that gets replaced as sometimes happens (e.g., gedit and certain configurations of docker), subsequent changes wont be watched.

This PR detects rename events and adds a 60s timeout with a 1s interval to watch for the path to exist, then emits a change event for that file, ensuring that:

  1. if the contents of the file changed between being removed and re-added that change is detected
  2. subsequent changes are detected

Split out from https://github.com/nodejs/node/pull/50890

Merge request reports

Loading