From afdc6aeea98e66df79d138597cbf2c3c1d5cfe67 Mon Sep 17 00:00:00 2001 From: Carsten Klein Date: Wed, 20 Mar 2019 21:29:19 +0100 Subject: [PATCH] fix #187: restore behaviour for #182 --- lib/tmp.js | 6 +----- test/child-process.js | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/tmp.js b/lib/tmp.js index 4e38f6c..2bc50ab 100644 --- a/lib/tmp.js +++ b/lib/tmp.js @@ -147,7 +147,7 @@ function _generateTmpName(opts) { (isBlank(opts.prefix) ? 'tmp-' : opts.prefix), process.pid, _randomChars(12), - (isBlank(opts.postfix) ? '' : opts.postfix) + (opts.postfix ? opts.postfix : '') ].join(''); return path.join(opts.dir || tmpDir, name); @@ -241,8 +241,6 @@ function file(options, callback) { opts = args[0], cb = args[1]; - opts.postfix = isBlank(opts.postfix) ? '.tmp' : opts.postfix; - // gets a temporary filename tmpName(opts, function _tmpNameCreated(err, name) { /* istanbul ignore else */ @@ -294,8 +292,6 @@ function fileSync(options) { args = _parseArguments(options), opts = args[0]; - opts.postfix = isBlank(opts.postfix) ? '.tmp' : opts.postfix; - const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor; const name = tmpNameSync(opts); var fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE); diff --git a/test/child-process.js b/test/child-process.js index dd9fd5b..ce2381b 100644 --- a/test/child-process.js +++ b/test/child-process.js @@ -82,9 +82,9 @@ function _doSpawn(commandArgs, cb, signal) { if (signal) { setTimeout(function () { - // does not work on node 6 + // SIGINT does not work on node <8.12.0 child.kill(signal); - }, 2000); + }, 1000); } }