Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HOTFIX #187: restore behaviour for #182 #188

Merged
merged 1 commit into from Mar 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Expand Up @@ -48,6 +48,15 @@ dependency to version 0.0.33.
For node versions < 0.8 you must limit your node-tmp dependency to
versions < 0.0.33.

### Node Versions < 8.12.0

The SIGINT handler will not work correctly with versions of NodeJS < 8.12.0.

### Windows

Signal handlers for SIGINT will not work. Pressing CTRL-C will leave behind
temporary files and directories.

## How to install

```bash
Expand Down
6 changes: 1 addition & 5 deletions lib/tmp.js
Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions test/child-process.js
Expand Up @@ -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);
}
}

Expand Down