diff --git a/bin/vows b/bin/vows index 8946ab3..a8e74a9 100755 --- a/bin/vows +++ b/bin/vows @@ -5,6 +5,7 @@ var path = require('path'), fs = require('fs'), util = require('util'), wildcard = require('../lib/utils/wildcard').wildcard, + NullStream = require('../lib/utils/nullstream').NullStream, events = require('events'); // @@ -191,7 +192,7 @@ if (options.supressStdout) { var devNullStream = null; if(process.platform === 'win32'){ - devNullStream = fs.createWriteStream('.nul'); + devNullStream = new NullStream(); } else { devNullStream = fs.createWriteStream('/dev/null'); } diff --git a/lib/utils/nullstream.js b/lib/utils/nullstream.js new file mode 100644 index 0000000..c0ab964 --- /dev/null +++ b/lib/utils/nullstream.js @@ -0,0 +1,30 @@ +/* + * nullstream.js: A simple stream to have a writestream accept all data written to it + * Used on windows to replace writing to /dev/null + * + * (C) 2012 MSOpenTech Inc. + * + */ +var Stream = require('stream').Stream; + +var NullStream = function () { + Stream.call(this); + this.writable = true; +}; + +exports.NullStream = NullStream; + +// Inherit from base stream class. +require('util').inherits(NullStream, Stream); + +// Extract args to `write` and emit as `data` event. +NullStream.prototype.write = function (data) { + console.log('************' + data); + return true; +}; + + +// Extract args to `end` and emit as `end` event. +NullStream.prototype.end = function () { + this.emit('end'); +}; \ No newline at end of file