Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cwd option in child_process exports not working in MacOS 10.x #2214

Closed
ThatOneBro opened this issue Feb 27, 2023 · 4 comments
Closed

cwd option in child_process exports not working in MacOS 10.x #2214

ThatOneBro opened this issue Feb 27, 2023 · 4 comments
Labels
bug Something isn't working macOS An issue that occurs on macOS node.js Compatibility with Node.js APIs

Comments

@ThatOneBro
Copy link
Contributor

Jarred-Sumner The big caveat for the workaround proposed for posix_spawn_file_actions_addchdir_np on macOS 10.x is that the cwd option for the following calls cannot be overridden and will incorrectly use the current working directory of the calling process:

child_process.exec
child_process.execSync
child_process.spawn
child_process.spawnSync
child_process.execFile
child_process.execFileSync

as they're all based on Bun.spawn which calls:

actions.chdir(cwd) catch |err| return globalThis.handleError(err, "in chdir()");

which in turn calls:

pub fn chdir(self: *Actions, path: []const u8) !void {
const posix_path = try toPosixPath(path);
return self.chdirZ(&posix_path);
}
pub fn chdirZ(self: *Actions, path: [*:0]const u8) !void {
switch (errno(system.posix_spawn_file_actions_addchdir_np(&self.actions, path))) {

Until a proper fix is made for macos 10.x, an assert could be added to terminate the program if the cwd option is specified and does not match the normalized getcwd().

When I proposed the original workaround I thought it was an unimportant start-up instruction.

Originally posted by @kzc in #1266 (comment)

We should at least add the aforementioned assert and terminate with error message explaining the current issue with MacOS 10.x

@ThatOneBro ThatOneBro added bug Something isn't working os node.js Compatibility with Node.js APIs labels Feb 27, 2023
@kzc
Copy link

kzc commented Feb 27, 2023

Related question... the github code search box in their web interface doesn't work for zig file extensions?

For example:

The search only produces results for Commits and Issues - but not Code.

Strangely, text within js files within this repo cannot be found by Code search either:

One such occurrence not found by github Code search:

export function execFileSync(file, args, options) {

Contrast this with a global github search which will produce Code results for other projects for js files:

Does a repo need some sort of .github yaml file to enable github Code search?

@ThatOneBro
Copy link
Contributor Author

Seems to work for me but idk, maybe it's just some hiccups with search.

@kzc
Copy link

kzc commented Feb 27, 2023

Could be an undocumented Github Pro thing.

@kzc
Copy link

kzc commented Feb 27, 2023

I figured it out. Code search only works if you opt in to the Github Beta Feature "New Code Search and Code View". Traditional github code search is buggy and only works in certain repos.

@paperdave paperdave added macOS An issue that occurs on macOS and removed os labels Jun 4, 2024
@Jarred-Sumner Jarred-Sumner closed this as not planned Won't fix, can't repro, duplicate, stale Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working macOS An issue that occurs on macOS node.js Compatibility with Node.js APIs
Projects
None yet
Development

No branches or pull requests

4 participants