Gulp task is hanging when using node-notifier

113 Views Asked by At

I'm trying to figure out what's causing my gulp task to hang, and it appears to be due to using node-notifier to send a notification. I can't seem to figure out why, or how to get it to not have this timeout.

I've created this minimal task example, which should theoretically end immediately. It logs that it has finished right away, but then it can take 5 to 10 seconds to actually finish running, which is less than ideal!

const notifier = require('node-notifier');

gulp.task('test', function(){
  const promise = new Promise(resolve => resolve());
  promise.then(function(){
    notifier.notify({ title: 'Title', message: 'Message' });
  });
  return promise;
});

Is there anything I can do to get the the task to stop running as soon as the promise is resolved, and the notification has been triggered?

0

There are 0 best solutions below