Skip to content

Commit cf86a2b

Browse files
committed
Fixed process.chdir() in workers.
1 parent 6763c8c commit cf86a2b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
'use strict';
66

77
// Overwrites the current directory
8-
process.chdir(process.mainModule.path);
98

109
const NODE_MODULES = { buffer: 1, child_process: 1, process: 1, fs: 1, events: 1, http: 1, https: 1, http2: 1, util: 1, net: 1, os: 1, path: 1, punycode: 1, readline: 1, repl: 1, stream: 1, string_decoder: 1, tls: 1, trace_events: 1, tty: 1, dgram: 1, url: 1, v8: 1, vm: 1, wasi: 1, worker_threads: 1, zlib: 1, crypto: 1, dns: 1 };
1110
const EMPTYOBJECT = {};
@@ -3061,3 +3060,7 @@ F.on('$cors', function() {
30613060
});
30623061

30633062
module.exports = F;
3063+
3064+
// process.chdir() doesn't work in Node.js workers
3065+
if (!F.Worker.parentPort)
3066+
process.chdir(process.mainModule.path);

0 commit comments

Comments
 (0)