diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js index 932f282a1bae2c..565cd4a77a15c9 100644 --- a/lib/internal/main/worker_thread.js +++ b/lib/internal/main/worker_thread.js @@ -116,14 +116,9 @@ port.on('message', (message) => { // The counter is only passed to the workers created by the main thread, not // to workers created by other workers. let cachedCwd = ''; - let lastCounter = -1; const originalCwd = process.cwd; process.cwd = function() { - const currentCounter = Atomics.load(cwdCounter, 0); - if (currentCounter === lastCounter) - return cachedCwd; - lastCounter = currentCounter; cachedCwd = originalCwd(); return cachedCwd; }; diff --git a/lib/internal/process/main_thread_only.js b/lib/internal/process/main_thread_only.js index 0cb3edbf9ad7b4..8af402c57a6cb0 100644 --- a/lib/internal/process/main_thread_only.js +++ b/lib/internal/process/main_thread_only.js @@ -39,8 +39,7 @@ function wrapProcessMethods(binding) { } function cwd() { - if (cachedCwd === '') - cachedCwd = binding.cwd(); + cachedCwd = binding.cwd(); return cachedCwd; }