Skip to content

Commit 05aba23

Browse files
authored
Merge pull request #188 from raszi/gh-187
HOTFIX #187: restore behaviour for #182
2 parents 69ad512 + 0f7a3d4 commit 05aba23

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ dependency to version 0.0.33.
4848
For node versions < 0.8 you must limit your node-tmp dependency to
4949
versions < 0.0.33.
5050

51+
### Node Versions < 8.12.0
52+
53+
The SIGINT handler will not work correctly with versions of NodeJS < 8.12.0.
54+
55+
### Windows
56+
57+
Signal handlers for SIGINT will not work. Pressing CTRL-C will leave behind
58+
temporary files and directories.
59+
5160
## How to install
5261

5362
```bash

lib/tmp.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function _generateTmpName(opts) {
147147
(isBlank(opts.prefix) ? 'tmp-' : opts.prefix),
148148
process.pid,
149149
_randomChars(12),
150-
(isBlank(opts.postfix) ? '' : opts.postfix)
150+
(opts.postfix ? opts.postfix : '')
151151
].join('');
152152

153153
return path.join(opts.dir || tmpDir, name);
@@ -241,8 +241,6 @@ function file(options, callback) {
241241
opts = args[0],
242242
cb = args[1];
243243

244-
opts.postfix = isBlank(opts.postfix) ? '.tmp' : opts.postfix;
245-
246244
// gets a temporary filename
247245
tmpName(opts, function _tmpNameCreated(err, name) {
248246
/* istanbul ignore else */
@@ -294,8 +292,6 @@ function fileSync(options) {
294292
args = _parseArguments(options),
295293
opts = args[0];
296294

297-
opts.postfix = isBlank(opts.postfix) ? '.tmp' : opts.postfix;
298-
299295
const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;
300296
const name = tmpNameSync(opts);
301297
var fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);

test/child-process.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ function _doSpawn(commandArgs, cb, signal) {
8282

8383
if (signal) {
8484
setTimeout(function () {
85-
// does not work on node 6
85+
// SIGINT does not work on node <8.12.0
8686
child.kill(signal);
87-
}, 2000);
87+
}, 1000);
8888
}
8989
}
9090

0 commit comments

Comments
 (0)