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

volta run affects only 1st command in case of chained commands (e.g. when using && operator) #1681

Open
bobo96run opened this issue Feb 5, 2024 · 1 comment

Comments

@bobo96run
Copy link

Hi and thank you first for this awesome tool!

When using the volta run command (https://docs.volta.sh/reference/run) with chained commands (using command chaining operators, like ;, && and the like, see e.g. https://www.geeksforgeeks.org/chaining-commands-in-linux/), only the first one is affected by the volta run options:

# Node 14 in current project
volta run --node 16 node -v && node -v  
v16.20.2
v14.21.3

This may be implicit from the documentation of volta run (only a single <command> is mentioned in the usage), but I think it would be worth mentioning it explicitly in the docs?

@bobo96run bobo96run changed the title volta run affects only 1st command in case of chained commands (e.g. when using && operator) volta run affects only 1st command in case of chained commands (e.g. when using && operator) Feb 5, 2024
@rytmis
Copy link
Contributor

rytmis commented Feb 5, 2024

I think that's due to the shell handling the &&. volta run can't handle that, because it never sees the other command.

However, if you explicitly invoke the command chain with a shell like so: volta run --node 16 bash -c "node -v && node -v", then the shell you are running the command from won't parse the &&, but the shell you are invoking with Volta will, resulting in the same node version for all commands:

image

This could probably be an additional recipe on the documentation. 🤔

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

No branches or pull requests

2 participants