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

[Bun Shell]: Error calling cmd/bat scripts when both args and path contain spaces #11328

Open
SunsetTechuila opened this issue May 24, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@SunsetTechuila
Copy link
Contributor

SunsetTechuila commented May 24, 2024

What version of Bun is running?

1.1.9+bb13798d9

What platform is your computer?

Microsoft Windows NT 10.0.22635.0 x64

What steps can reproduce the bug?

run

import { $ } from "bun";
const fields = "name scripts"
await $`npm pkg get ${fields}`;

What is the expected behavior?

I expect that code to show the package name and scripts like this code does:

import { $ } from "bun";
const fields = ["name", "scripts"];
await $`npm pkg get ${fields}`;

What do you see instead?

ShellError: Failed with exit code 1
 info: {
  "exitCode": 1,
  "stderr": "'C:\\Program' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n",
  "stdout": ""
}

Additional information

related: nodejs/node#7367

possible fixes:
SunsetTechuila@d963370
SunsetTechuila@1c05351

wrapping path in quotes doesn't seem to work

@SunsetTechuila SunsetTechuila added the bug Something isn't working label May 24, 2024
@SunsetTechuila SunsetTechuila changed the title [Bun Shell]: Error calling cmd/bat scripts when both arguments and path contain spaces on Windows [Bun Shell]: Error calling cmd/bat scripts when both args and path contain spaces on Windows May 24, 2024
@SunsetTechuila
Copy link
Contributor Author

SunsetTechuila commented May 24, 2024

it is ok not to pass the absolute path
libuv (library, which both bun and node use to spawn processes) docs:

Since uv_spawn uses execvp(3) internally, there is no need to supply the full path.

so committing the second suggested fix would be fine, I think. Let me know if it is - I'll open a PR

@SunsetTechuila SunsetTechuila changed the title [Bun Shell]: Error calling cmd/bat scripts when both args and path contain spaces on Windows [Bun Shell]: Error calling cmd/bat scripts when both args and path contain spaces May 24, 2024
SunsetTechuila added a commit to SunsetTechuila/bun that referenced this issue May 25, 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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant