"use strict";function which(e){try{return _which(e),e}catch(t){return!1}}function normalizeLineEndings(e){return e.replace(/\r?\n/g,"\n")}function run(e,t){exec(e,function(e,n){t(e?e.code:0,normalizeLineEndings(n))})}function fixture(e){return normalizeLineEndings(String(fs.readFileSync(e)))}function buildTests(){var e=[10,100,1e3],t=[" stdout stderr"," stdout"," stderr"],n=[""," | "+grep+' "std"'];e.forEach(function(e){t.forEach(function(t){n.forEach(function(n){var r="node log.js 0 "+e+t+" 2>&1"+n;exports.exit["output ("+r+")"]=function(n){n.expect(2),run(r,function(r,i){var s=fixture(e+t.replace(/ /g,"-")+".txt");n.equal(i.length,s.length,"should be the same length."),n.ok(i.indexOf("fail")===-1,"should not output after exit is called."),n.done()})}})})});var r=[0,1,123];r.forEach(function(e){var t="node log.js "+e+" 10 stdout stderr";exports.exit["exit code ("+t+")"]=function(n){n.expect(1),run(t,function(t){n.equal(t,e,"should exit with "+e+" error code."),n.done()})}})}var fs=require("fs"),exec=require("child_process").exec,_which=require("which").sync,grep=which("grep")||process.platform==="win32"&&which("find");exports.exit={setUp:function(e){this.origCwd=process.cwd(),process.chdir("test/fixtures"),e()},tearDown:function(e){process.chdir(this.origCwd),e()},grep:function(e){e.expect(1),e.ok(grep,'A suitable "grep" or "find" program was not found in the PATH.'),e.done()}},grep&&buildTests();