-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Open
Description
Version
v24.11.0
Platform
Microsoft Windows NT 10.0.26100.0 x64
Subsystem
No response
What steps will reproduce the bug?
Run the following code on Windows.
process.env = {};
console.log(require('os').tmpdir());How often does it reproduce? Is there a required condition?
Frequency is 100%
What is the expected behavior? Why is that the expected behavior?
os.tmpdir() should return a correct temporary directory path. Ideally it should return a value returned from the platform-specific APIs like GetTempPath2W. Or it should raise an error that it could not make a proper path.
What do you see instead?
os.tmpdir() returns the incorrect directory path undefined\temp.
Additional information
This issue happens when the node process is run in some separate sandboxed environments (for example, testing environment which wants to avoid effects by environment variables).
Current implementation:
Lines 182 to 184 in cfa11ba
| const path = process.env.TEMP || | |
| process.env.TMP || | |
| (process.env.SystemRoot || process.env.windir) + '\\temp'; |
Metadata
Metadata
Assignees
Labels
No labels