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

expose a way to show compilation progress? #30

Closed
oconnor663 opened this issue Jul 25, 2021 · 3 comments
Closed

expose a way to show compilation progress? #30

oconnor663 opened this issue Jul 25, 2021 · 3 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@oconnor663
Copy link

oconnor663 commented Jul 25, 2021

Currently when I use rust-script in a shebang line, the first execution of the script hangs for quite a while as all the dependencies are being compiled. This is fine for me personally, since I know what it's doing, but I worry that if I shipped a script like that to other users they might think it was broken and Ctrl-C it or similar. Is there an option to tell rust-script to print something to stderr (or just un-suppress Cargo output) when it needs to build?

@fornwall fornwall added enhancement New feature or request question Further information is requested labels Jul 29, 2021
@fornwall
Copy link
Owner

Does the -o, --cargo-output output work here? So the shebang line would be #!/usr/bin/env rust-script --cargo-output.

@oconnor663
Copy link
Author

oconnor663 commented Jul 29, 2021

Ah I totally missed that. Looks like #! /usr/bin/env -S rust-script -o does the trick. My problem with that solution is that it always prints Cargo output. So for example, subsequent runs of my scripts look something like:

    Finished release [optimized] target(s) in 0.01s
     Running `/home/jacko/.cache/rust-script/binaries/release/test_74853f43f948f18a031eff82`
some output

Would it be possible to tell from the hash of the script itself that it doesn't need to be rebuilt, and avoid output (and possibly avoid invoking Cargo entirely) in this case? I realize that this might be a substantially larger change than this issue was originally asking about.

@fornwall
Copy link
Owner

Would it be possible to tell from the hash of the script itself that it doesn't need to be rebuilt, and avoid output (and possibly avoid invoking Cargo entirely) in this case? I realize that this might be a substantially larger change than this issue was originally asking about.

Version 0.23.0 has just been released, and does it just as described above! Thanks for the feedback.

Also, note that the short option for --cargo-output has been changed from -o to -c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants