Skip to content

Commit

Permalink
Merge pull request #147 from raszi/gh-146
Browse files Browse the repository at this point in the history
with name option try at most once to get a unique tmp name
  • Loading branch information
raszi committed Aug 12, 2017
2 parents fb3801a + a9769f9 commit 9f4071e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/tmp.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function tmpName(options, callback) {
args = _parseArguments(options, callback),
opts = args[0],
cb = args[1],
tries = opts.tries || DEFAULT_TRIES;
tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;

if (isNaN(tries) || tries < 0)
return cb(new Error('Invalid tries'));
Expand Down Expand Up @@ -181,7 +181,7 @@ function tmpNameSync(options) {
var
args = _parseArguments(options),
opts = args[0],
tries = opts.tries || DEFAULT_TRIES;
tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;

if (isNaN(tries) || tries < 0)
throw new Error('Invalid tries');
Expand Down

0 comments on commit 9f4071e

Please sign in to comment.