diff --git a/appveyor.yml b/appveyor.yml index c774a77..aef7b0a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,6 +6,8 @@ environment: - nodejs_version: "5" - nodejs_version: "6" - nodejs_version: "7" + - nodejs_version: "8" + - nodejs_version: "9" install: - ps: Install-Product node $env:nodejs_version diff --git a/lib/tmp.js b/lib/tmp.js index 1175a4f..3d49831 100644 --- a/lib/tmp.js +++ b/lib/tmp.js @@ -547,6 +547,24 @@ function _safely_install_listener() { } } + // windows does not support signals + // 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({ + input: process.stdin, + output: process.stdout + }); + + rl.on("SIGINT", function () { + process.emit("SIGINT"); + }); + } + + process.on('SIGINT', function () { + process.exit(0); + }); + process.addListener(EVENT, function _tmp$safe_listener(data) { if (existingListeners.length) { for (var i = 0, length = existingListeners.length; i < length; i++) { @@ -559,7 +577,6 @@ function _safely_install_listener() { _safely_install_listener(); - /** * Configuration options. * diff --git a/package-lock.json b/package-lock.json index 136640c..8ec7480 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "tmp", - "version": "0.0.33", + "version": "0.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/test/child-process.js b/test/child-process.js index 20c6c02..9716594 100644 --- a/test/child-process.js +++ b/test/child-process.js @@ -19,7 +19,7 @@ module.exports.genericChildProcess = function spawnGenericChildProcess(configFil _do_spawn(command_args, cb); }; -module.exports.childProcess = function spawnChildProcess(configFile, cb) { +module.exports.childProcess = function spawnChildProcess(configFile, cb, detach) { var configFilePath = path.join(__dirname, 'outband', configFile), command_args = [path.join(__dirname, 'spawn-custom.js'), configFilePath]; @@ -28,10 +28,16 @@ module.exports.childProcess = function spawnChildProcess(configFile, cb) { if (!existsSync(configFilePath)) return cb(new Error('ENOENT: configFile ' + configFilePath + ' does not exist')); - _do_spawn(command_args, cb); + if (arguments.length > 2) { + for (var i=2; i