Skip to content

Commit 9c76c95

Browse files
ShogunPandatargos
authored andcommitted
src: only apply fix in main thread
PR-URL: #52702 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Marco Ippolito <[email protected]>
1 parent e1cba97 commit 9c76c95

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/parallel/test-process-load-env-file.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,17 @@ describe('process.loadEnvFile()', () => {
5858
const originalCwd = process.cwd();
5959

6060
try {
61-
process.chdir(join(originalCwd, 'lib'));
61+
if (common.isMainThread) {
62+
process.chdir(join(originalCwd, 'lib'));
63+
}
6264

6365
assert.throws(() => {
6466
process.loadEnvFile();
6567
}, { code: 'ENOENT', syscall: 'open', path: '.env' });
6668
} finally {
67-
process.chdir(originalCwd);
69+
if (common.isMainThread) {
70+
process.chdir(originalCwd);
71+
}
6872
}
6973
});
7074

0 commit comments

Comments
 (0)