summaryrefslogtreecommitdiff
path: root/lib/os.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/os.js')
-rw-r--r--lib/os.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/os.js b/lib/os.js
index 7c07a5b0d3..eb13139dba 100644
--- a/lib/os.js
+++ b/lib/os.js
@@ -21,7 +21,7 @@
'use strict';
-const { pushValToArrayMax } = process.binding('util');
+const { pushValToArrayMax, safeGetenv } = process.binding('util');
const constants = process.binding('constants').os;
const { deprecate } = require('internal/util');
const { getCIDRSuffix } = require('internal/os');
@@ -127,9 +127,9 @@ function tmpdir() {
if (path.length > 1 && path.endsWith('\\') && !path.endsWith(':\\'))
path = path.slice(0, -1);
} else {
- path = process.env.TMPDIR ||
- process.env.TMP ||
- process.env.TEMP ||
+ path = safeGetenv('TMPDIR') ||
+ safeGetenv('TMP') ||
+ safeGetenv('TEMP') ||
'/tmp';
if (path.length > 1 && path.endsWith('/'))
path = path.slice(0, -1);