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

Multiple commands in build.command fail on Linux #236

Closed
tcmal opened this issue Jan 13, 2022 · 1 comment · Fixed by #311
Closed

Multiple commands in build.command fail on Linux #236

tcmal opened this issue Jan 13, 2022 · 1 comment · Fixed by #311

Comments

@tcmal
Copy link

tcmal commented Jan 13, 2022

For example, with a rust project:

[build]
command = "cargo install -q worker-build && worker-build --release" # required

I get:

$ wrangler dev -l build/worker/shim.mjs
running: cargo install -q worker-build && worker-build --release
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ B to open a browser, D to open Devtools, S to turn on (experimental) sharing, L to turn off local mode, X to exit │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
error: Found argument '--release' which wasn't expected, or isn't valid in this context

USAGE:
...

Indicating cargo is being passed worker-build --release as an argument.

I think this is caused here, and it should be something like execva('sh', ['-c', commandPieces.join(" ")])

This looks like it would also affect mac and windows, though I can't test either.

Using v0.0.7 with node v16.13.1

@Electroid Electroid added the bug label Jan 13, 2022
@threepointone
Copy link
Contributor

Great catch. Will fix.

@Electroid Electroid added this to the 2.0 milestone Jan 20, 2022
threepointone added a commit that referenced this issue Jan 26, 2022
We were running custom builds as a regular command with `execa`. This would fail whenever we tried to run compound commands like `cargo install -q worker-build && worker-build --release` (via #236). The fix is to use `shell: true`, so that the command is run in a shell and can thus use bash-y syntax like `&&`, and so on. I also switched to using `execaCommand` which splits a command string into parts correctly by itself.
threepointone added a commit that referenced this issue Jan 26, 2022
We were running custom builds as a regular command with `execa`. This would fail whenever we tried to run compound commands like `cargo install -q worker-build && worker-build --release` (via #236). The fix is to use `shell: true`, so that the command is run in a shell and can thus use bash-y syntax like `&&`, and so on. I also switched to using `execaCommand` which splits a command string into parts correctly by itself.
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 a pull request may close this issue.

3 participants