Skip to content

Instantly share code, notes, and snippets.

@isaacs
Last active August 27, 2015 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacs/832dbcf3e9e22574989d to your computer and use it in GitHub Desktop.
Save isaacs/832dbcf3e9e22574989d to your computer and use it in GitHub Desktop.
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