From 9c76c95c106340d6053a6d2dbefb33452697d730 Mon Sep 17 00:00:00 2001 From: Paolo Insogna Date: Sun, 5 May 2024 07:37:12 +0200 Subject: [PATCH] src: only apply fix in main thread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/52702 Reviewed-By: Moshe Atlow Reviewed-By: Benjamin Gruenbaum Reviewed-By: James M Snell Reviewed-By: Tobias Nießen Reviewed-By: Marco Ippolito --- test/parallel/test-process-load-env-file.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-process-load-env-file.js b/test/parallel/test-process-load-env-file.js index a84795c7e3f1d3..41e487b39b390c 100644 --- a/test/parallel/test-process-load-env-file.js +++ b/test/parallel/test-process-load-env-file.js @@ -58,13 +58,17 @@ describe('process.loadEnvFile()', () => { const originalCwd = process.cwd(); try { - process.chdir(join(originalCwd, 'lib')); + if (common.isMainThread) { + process.chdir(join(originalCwd, 'lib')); + } assert.throws(() => { process.loadEnvFile(); }, { code: 'ENOENT', syscall: 'open', path: '.env' }); } finally { - process.chdir(originalCwd); + if (common.isMainThread) { + process.chdir(originalCwd); + } } });