Skip to content

Add -S flag to provide multiple args to /usr/bin/env #25

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

VV0JC13CH
Copy link
Contributor

@VV0JC13CH VV0JC13CH commented Dec 1, 2024

I promised myself not to propose Pull request on day one this year, but here we are :-)
After execution of just get-input day-01 I received:

./scripts/get-aoc-input.rs --day day-01 --current-working-directory /mnt/projects/Exercises/advent-of-code/2024/rust
/usr/bin/env: ‘cargo +nightly -Zscript’: No such file or directory
/usr/bin/env: use -[v]S to pass options in shebang lines
error: Recipe `get-input` failed on line 32 with exit code 127

To fix this I added -S flag (based on docs of cargo unstable features) in get-aoc-input.rs and it started to work.

#!/usr/bin/env -S cargo +nightly -Zscript

docs: https://doc.rust-lang.org/cargo/reference/unstable.html?highlight=-Z%20min#script

 env --help
  -S, --split-string=S  process and split S into separate arguments;
                        used to pass multiple arguments on shebang lines

This issue happened on Pop!_OS, fish shell.

@ChristopherBiscardi
Copy link
Owner

hehe thanks for the PR! I'm cool with this being merged. just need to do a bit of testing to make sure it also works on other platforms (especially macos, which I use for the videos).

@paulora2405
Copy link

The issue also happens on Red Hat Enterprise Linux 9.4. Adding the -S flag fixes the problem.

I'll test in macOS today.

@bburnichon
Copy link

Same issue on Ubuntu 24.04 bash

@paulora2405
Copy link

The issue also happens on Red Hat Enterprise Linux 9.4. Adding the -S flag fixes the problem.

I'll test in macOS today.

I've tested on macOS, and adding the flag does not cause any problems, so it should be good to merge the change.

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.

4 participants