diff --git a/lib/tmp.js b/lib/tmp.js index 8fe48a0..a2192c2 100644 --- a/lib/tmp.js +++ b/lib/tmp.js @@ -597,7 +597,7 @@ function _safely_install_listener() { // it'd never had won if it wasn't a major PITA // with node v8.x and win 10 this is no longer an issue if (process.platform == 'win32') { - var rl = require('readline').createInterface({ + const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout }); diff --git a/test/issue121-test.js b/test/issue121-test.js index 69a24f3..911b1eb 100644 --- a/test/issue121-test.js +++ b/test/issue121-test.js @@ -2,25 +2,26 @@ // vim: expandtab:ts=2:sw=2 const - assert = require('assert'), assertions = require('./assertions'), childProcess = require('./child-process').childProcess, signals = ['SIGINT', 'SIGTERM']; describe('tmp', function () { describe('issue121 - clean up on terminating signals', function () { - for (var i=0; i < signals.length; i++) { - issue121Tests(signals[i]); + for (var i = 0; i < signals.length; i++) { + it('for signal ' + signals[i], function (done) { + issue121Tests(signals[i])(done); + }); } }); }); function issue121Tests(signal) { return function (done) { - childProcess('issue121.json', function (err, stderr, stdout) { + childProcess(this, 'issue121.json', function (err, stderr, stdout) { if (err) return done(err); else if (stderr) return done(new Error(stderr)); - else assertions.assertDoesNotExist(stdout); + assertions.assertDoesNotExist(stdout); done(); }, true); }; diff --git a/test/outband/issue121.js b/test/outband/issue121.js index 0dce377..927f11f 100644 --- a/test/outband/issue121.js +++ b/test/outband/issue121.js @@ -11,7 +11,13 @@ tmp.setGracefulCleanup(); // https://github.com/raszi/node-tmp/issues/121 module.exports = function (signal) { - fixture.apply(this, [tmp.dirSync({ unsafeCleanup: true }), tmp]); + try { + fixture.apply(this, [tmp.dirSync({ unsafeCleanup: true }), tmp]); + } + catch (ex) { + console.err(ex); + throw ex; + } // make sure that the process keeps running setTimeout(function () {}, 1000000);