Skip to content

Conversation

@mischnic
Copy link
Contributor

@mischnic mischnic commented Nov 26, 2020

On more recent Node versions process.chdir.disabled is true in Workers (because that function isn't supported in worker threads). It was previously not copied over to the chdir wrapper.

Example (this issue causes an exception on Windows because moxystudio/node-cross-spawn#132 need to check for chdir.disabled):

// x.js
const {Worker} = require("worker_threads");
new Worker("./y.js");


// y.js
require('graceful-fs');
console.log(process.chdir.disabled, "should be true in a Worker"); // prints "undefined should ...."

const spawn = require('cross-spawn');
spawn('ps', [], {cwd: process.cwd()}) // this call fails on windows

Co-authored-by: Corey Farrell <[email protected]>
@mischnic mischnic changed the title Copy over process.chdir.disabled if set Support process.chdir.disabled Nov 27, 2020
Co-authored-by: Corey Farrell <[email protected]>
@isaacs isaacs closed this in 7b85570 Feb 5, 2021
@mischnic mischnic deleted the patch-1 branch February 5, 2021 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants