You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using watcher (and typically the hotreloader package), processes never seem to be killed whilst watch events are being listened too. A minimal setup of this looks like:
Process process =awaitProcess.start('some-long-lived-process');
final watcher =DirectoryWatcher(p.join(Directory.current.path, 'lib'));
watcher.events.listen((event) async {
final result = process.exit();
print(result); // true
});
Looking at activity monitor, the process spawned is never killed. I've tried a combination of signals, but upon investigation the process simply never exists whilst the watcher is active. This also includes trying to exist outside of the listener.
My current workaround is to kill the watcher on an event, kill the process and restart the flow. Something like:
while (true) {
Process process =awaitProcess.start('some-long-lived-process');
final watcher =DirectoryWatcher(p.join(Directory.current.path, 'lib'));
final completer =Completer();
StreamSubscription? watcherSubscription;
watcherSubscription = watcher.events.listen((event) async {
if (!completer.isCompleted) completer.complete();
});
await completer.future; // wait for an eventawait watcherSubscription.cancel(); // stop the watcher
process.kill(); // kill the process// while loop starts it again
}
Probably worth noting I'm on MacOS here.
The text was updated successfully, but these errors were encountered:
When using
watcher
(and typically thehotreloader
package), processes never seem to be killed whilst watch events are being listened too. A minimal setup of this looks like:Looking at activity monitor, the process spawned is never killed. I've tried a combination of signals, but upon investigation the process simply never exists whilst the watcher is active. This also includes trying to exist outside of the listener.
My current workaround is to kill the watcher on an event, kill the process and restart the flow. Something like:
Probably worth noting I'm on MacOS here.
The text was updated successfully, but these errors were encountered: