-
Notifications
You must be signed in to change notification settings - Fork 6
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
Prevent project shutdown on watch mode #47
Conversation
Ah, thanks for the PR! I think I've always just run with |
I've so far considered Given the role of I have used Unless there's compelling arguments to keep
Given that my usage of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after one comment! Thanks!
There's no point in keeping the process alive on 'watch' mode, but being unable to reload on any file changes. Before this fix, we would need to use 'watch' and 'supervise' modes together to achieve this. This fix makes 'watch' mode behave like 'supervise' mode, but getting rid of the latter.
There's a subtle difference for long-running processes that don't automatically end. With only |
@airhorns can you publish a new version pls? |
Got it. I also noticed the tests keep running infinitely, it's probably because, as you say, now the process doesn't end https://github.com/gadget-inc/wds/runs/7234432137 |
Hi, I've just discovered this package and I was surprised on how fast it was 🚀
Unfortunately I tried using it on
watch
mode, but the program kept ending on any file change (apparently someone else has already noticed the same issue #45 )So... this is my shot into fixing it 🐞
Issue
In order to react to changes in our files, the
watcher
triggers achange
event, that in turn triggers aproject reload
.This
project reload
forces asupervisor
restart, that in the code is implemented by killing the current process and creating a new one.wds/src/Supervisor.ts
Lines 32 to 46 in f89b208
This
process exit
is caught in thesupervisor exit
event, but it's only prevented for thesupervise mode
case.wds/src/index.ts
Lines 172 to 177 in f89b208
Possible solution
My proposed solution is to add the missing
reload on changes mode
case, preventing to kill our 'project' on any file change.Images
Running original file (watch mode is enabled by default)
Modifying and saving changes to file
Previously the program would just end, like in the logs of #45