jakejs / jake

JavaScript build tool, similar to Make or Rake. Built to work with Node.js.
http://jakejs.com
Apache License 2.0
1.97k stars 190 forks source link

fail('myError' 42) does not really fail #250

Open jonstorer opened 10 years ago

jonstorer commented 10 years ago

I've setup a task called poke:staging. After I've deployed to staging, I'd like to check that it's up before I automatically push to production. However fail(err, 1) does not halt a command chain.

Example:

npm install && npm test && jake poke:staging && git push $COMMIT:production

if staging is down & I fail the poke:staging task, then git push $COMMIT:production should not run. It does.

Am I missing something?

mde commented 10 years ago

I can't reproduce this with a minimal example. I have a Jakefile like this:

task('success', function () {
  console.log('w00t');
});

task('failure', function () {
  fail(new Error(), 42);
});

Here's the output I get from running the two tasks:

lerxst:work mde$ ./jake/bin/cli.js success && echo howdy
w00t
howdy
lerxst:work mde$ echo $?
0
lerxst:work mde$ ./jake/bin/cli.js failure && echo howdy
jake aborted.
Error
    at null.action (/Users/mde/work/Jakefile:7:8)
    at TaskBase.run (/Users/mde/work/jake/lib/task/task.js:199:27)
(See full trace by running task with --trace)
lerxst:work mde$ echo $?
42