Do not reparse script when its deleted #26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using the
-e
flag, a Tempfile is created. This tempfile will be deleted once ruby GCs (as no reference to the tempfile is held anywhere), which will cause a:deleted
event.Once that happens, watchr will try to reparse the script, going into an endless loop because of a retry call in script.rb, receiving no further events.
This is only a possible solution to it; another option is to store the tempfile in a global variable (to avoid it ever getting GCd, and thus it will be never deleted). Doing it this way won’t guard against the file getting deleted by some other means, however.
Another way would be to finish the noted todo in script.rb, but I don’t know the complications so I decided not to try that :)