Last active
August 27, 2015 16:54
-
-
Save isaacs/832dbcf3e9e22574989d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs') | |
var n = +(process.argv[2]) || 1000 | |
var semis = new Array(n).join(';') | |
fs.writeFileSync('so-safe.js', semis + 'throw new Error("safety");\n') | |
var spawn = require('child_process').spawn | |
spawn(process.execPath, [__dirname + '/so-safe.js'], { | |
stdio: 'inherit' | |
}).on('close', function (code, signal) { | |
fs.unlinkSync('so-safe.js') | |
if (code) | |
console.log('TAP version 13\n1..1\nok - exited with code') | |
else if (signal) { | |
process.kill(process.pid, signal) | |
setTimeout(function () {}, 1000) | |
} else { | |
console.log('TAP version 13\n1..1\nnot ok - expected error code') | |
process.exit(1) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment