Skip to content
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

gulp-notify breaks Travis CI #11

Closed
anissen opened this issue Feb 13, 2014 · 9 comments
Closed

gulp-notify breaks Travis CI #11

anissen opened this issue Feb 13, 2014 · 9 comments

Comments

@anissen
Copy link

anissen commented Feb 13, 2014

Here is an excerpt from the log of a failing Travis CI build:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Command failed: /bin/sh: 1: notify-send: not found
    at ChildProcess.exithandler (child_process.js:637:15)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Socket.<anonymous> (child_process.js:956:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:466:12)

The command "gulp ci" exited with 8.

Done. Your build exited with 1.

Is this a gulp-notify-bug or is there some workaround to prevent it from running/failing on Travis or similar Linux-systems without notify-send installed?

@mikaelbr
Copy link
Owner

I think this is more of a bug in node-notifier. There should be a test there, seeing if notify-send is supported. Will post issue! Thanks for letting me know!

@anissen
Copy link
Author

anissen commented Feb 13, 2014

Wow, that was a quick response! Thanks :)

@anissen anissen closed this as completed Feb 13, 2014
@mikaelbr
Copy link
Owner

This is now fixed in mikaelbr/node-notifier#3, but I have some issues updating the package on NPM at this moment. But I will update the dependency as soon as I can.

@mikaelbr
Copy link
Owner

The dependency is now updated and there is a new version of gulp-notify. You might how ever get error that notify-send, isn't installed. I'll look into the possibility of adding a silent mode or fallbacking on gutil-log if no notification reporter is found.

You might also consider not using gulp-notify on your ci task, as it doesn't make too much sense to use it - or use gulp-if and gulp-util.env to conditionally activate gulp-notify depending on environment.

@anissen
Copy link
Author

anissen commented Feb 14, 2014

I updated to gulp-notify 0.4.6 but it still breaks Travis -- now in which, however.

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: not found: notify-send
    at F (/home/travis/build/anissen/parsecs/node_modules/gulp-notify/node_modules/node-notifier/node_modules/which/which.js:43:28)
    at E (/home/travis/build/anissen/parsecs/node_modules/gulp-notify/node_modules/node-notifier/node_modules/which/which.js:46:29)
    at /home/travis/build/anissen/parsecs/node_modules/gulp-notify/node_modules/node-notifier/node_modules/which/which.js:57:16
    at Object.oncomplete (fs.js:107:15)

The reason I use gulp-notify on my ci task is because my ci task depends on ["build", "test"] and build uses gulp-notify...

@anissen anissen reopened this Feb 14, 2014
@mikaelbr
Copy link
Owner

I think the best way is to use gulp-util.env to handle this.

Example:

gulp.task('task', function() {
  gulp.src('./src/*.js')
    .pipe(gutil.env.type !== 'ci' ? notify() : gutil.noop())
    .pipe(gulp.dest('./dist/'));
});

And then you can run gulp with env type of ci. gulp-util.env is a wrapper for minimist, so see documentation of that to see usage of flags.

Edit: Inverted env type check. Should use nofity() when not on CI.

@anissen
Copy link
Author

anissen commented Feb 14, 2014

That's an acceptable workaround for now :)

@anissen anissen closed this as completed Feb 14, 2014
@mikaelbr
Copy link
Owner

You can also make it fail silently by handling the error event that gulp-notify triggers.

..
 .pipe(notify())
 .on('error', gutil.log);

But due to pipe() this will stop pipeing (but it works if notify is the final step). To continue even on error, you can see the gulp-plumber project.

@LostCrew
Copy link

👍 for the env check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants