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 <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com>
1 parent 91b7f5e commit 826fb66

2 files changed

Lines changed: 1 addition & 7 deletions

File tree

‎lib/internal/main/worker_thread.js‎

Lines changed: 0 additions & 5 deletions
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
letcachedCwd='';
119-
letlastCounter=-1;
120119
constoriginalCwd=process.cwd;
121120

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

‎lib/internal/process/main_thread_only.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ function wrapProcessMethods(binding) {
3939
}
4040

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

0 commit comments

Comments
 (0)