Open doivosevic opened 9 years ago
I observe this on a regular basis. It appears to be a timing issue. If I change a file and then change it again during the correct time window before the end of processing, I observe some similar to watch you have observed.
Scheduled tasks have been interrupted... [...] Done, without errors.
I am using:
Node.js v4.2.1 grunt-contrib-watch 0.6.1 grunt v0.4.5 grunt-cli v0.1.13 Windows 7
I have also felt that it is a timing issue
I'm not at all familiar with node.js development, but I think see the issue. Experimentation suggests that the existence of a open Gaze object prevents the process from exiting. There is window of time between where all Gaze objects are closed and they are recreated. If the task completes in that time window, the process exits.
// Close any previously opened watchers
watchers.forEach(function(watcher) {
watcher.close();
});
watchers = [];
[...]
// Create watcher per target
watchers.push(new Gaze(patterns, target.options, function(err) {
Never mind my last post. I don't think that is the correct explanation anymore.
I have learned that this is the stack trace when the process exits:
grunt.js:
154: util.exit(0);
Grunt is exiting forcefully because it thinks the task has completed. I can make this happen on demand by touching a file, waiting about 1 second, and then touching the file again.
I have not been able to determine why grunt exits after an interrupt but I did discover that the problem is isolated to when the option spawn = false. Setting that option to the default (true), fixed the issue. I didn't author the original configuration, so I don't know why spawn was set to false. I'm going to go with the default for now!
So once every 100 successful builds the watch just stops after printing "Done, without errors" although it never exits usually.
console log: