Skip to content

Commit

Permalink
[bin] Supress stdout and stderr when run as a fork
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalecki authored and indexzero committed Dec 23, 2011
1 parent 2ac0459 commit df8d71d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion bin/forever
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
#!/usr/bin/env node

require('./../lib/forever').cli.start();
var fs = require('fs');

if (process.send) {
//
// Supress `stdout` and `stderr` when `forever` is being run as a fork.
// We use `child_process.fork` to daemonize `forever` processes, so
// outputting anything isn't a desired situation.
//
var nullStream = fs.createWriteStream('/dev/null');
var returner = function () {
return nullStream;
};
process.__defineGetter__('stdout', returner);
process.__defineGetter__('stderr', returner);
}

var forever = require('../lib/forever');
forever.cli.start();

0 comments on commit df8d71d

Please sign in to comment.