Skip to content

Commit 826fb66

Browse files
BridgeARtargos
authored andcommitted
process: compatibility patch to backport 1d022e8
This makes sure #27224 is possible to being backported in a semver-patch way. PR-URL: #27483 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Shelley Vohr <[email protected]>
1 parent 91b7f5e commit 826fb66

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

lib/internal/main/worker_thread.js

-5
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,9 @@ port.on('message', (message) => {
116116
// The counter is only passed to the workers created by the main thread, not
117117
// to workers created by other workers.
118118
let cachedCwd = '';
119-
let lastCounter = -1;
120119
const originalCwd = process.cwd;
121120

122121
process.cwd = function() {
123-
const currentCounter = Atomics.load(cwdCounter, 0);
124-
if (currentCounter === lastCounter)
125-
return cachedCwd;
126-
lastCounter = currentCounter;
127122
cachedCwd = originalCwd();
128123
return cachedCwd;
129124
};

lib/internal/process/main_thread_only.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ function wrapProcessMethods(binding) {
3939
}
4040

4141
function cwd() {
42-
if (cachedCwd === '')
43-
cachedCwd = binding.cwd();
42+
cachedCwd = binding.cwd();
4443
return cachedCwd;
4544
}
4645

0 commit comments

Comments
 (0)