Skip to content

Commit e162828

Browse files
authored
Merge pull request #309 from fflorent/fix-tmp-dir-with-dir
Fix use of tmp.dir() with `dir` option
2 parents 08fa3ab + b847d2f commit e162828

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/tmp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ function _resolvePath(name, tmpDir, cb) {
466466
cb(null, path.join(parentDir, path.basename(pathToResolve)));
467467
});
468468
} else {
469-
fs.realpath(path, cb);
469+
fs.realpath(pathToResolve, cb);
470470
}
471471
});
472472
}

test/inband-standard.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
var
55
fs = require('fs'),
6+
os = require('os'),
67
path = require('path'),
78
assertions = require('./assertions'),
89
tmp = require('../lib/tmp');
@@ -18,6 +19,7 @@ module.exports = function inbandStandard(isFile, beforeHook, sync = false) {
1819
describe('with mode', inbandStandardTests(null, { mode: 0o755 }, isFile, beforeHook, sync));
1920
describe('with multiple options', inbandStandardTests(null, { prefix: 'tmp-multiple', postfix: 'bar', mode: 0o750 }, isFile, beforeHook, sync));
2021
describe('with tmpdir option', inbandStandardTests(null, { tmpdir: path.join(tmp.tmpdir, 'tmp-external'), mode: 0o750 }, isFile, beforeHook, sync));
22+
describe('with dir option', inbandStandardTests(null, { dir: os.tmpdir(), mode: 0o750 }, isFile, beforeHook, sync));
2123
if (isFile) {
2224
describe('with discardDescriptor', inbandStandardTests(null, { mode: testMode, discardDescriptor: true }, isFile, beforeHook, sync));
2325
describe('with detachDescriptor', inbandStandardTests(null, { mode: testMode, detachDescriptor: true }, isFile, beforeHook, sync));

0 commit comments

Comments
 (0)