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

error: Expected expression but got a shebang #891

Open
karaiwulf opened this issue Nov 23, 2024 · 1 comment
Open

error: Expected expression but got a shebang #891

karaiwulf opened this issue Nov 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@karaiwulf
Copy link

Hello friends,

If I'm reading this right, shebang parsing (and ignoring) was implemented in #353 (requested in #270); however, I am unable to use shebang lines in my scripts in version git-496577c9 (just cloned and built on nightly-x86_64-unknown-linux-gnu and nightly-x86_64-unknown-illumos).

Steps to replicate:

  • clone repo
  • cargo install --path crates/rune-cli (installing via crates.io produces broken rune?)
  • create hello_world.rn with the following contents:
#!/usr/bin/env -S rune run

println!("Hellorld");
  • chmod +x hello_world.rn
  • ./hello_world.rn:
error: Expected expression but got a shebang
  ┌─ ./hello_world.rn:1:1
  │
1 │ #!/usr/bin/env -S rune run
  │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected expression but got a shebang

Error: Failed to build rune sources (see diagnostics for details)

Expected output (from rune run hello_world.rn with shebang removed):

Hellorld

I haven't seen anything about this in the documentation, but it appears that shebangs are intended to work. Have I missed something? Am I not building it correctly to enable this feature? Is this related to the nightly toolchain?

Please let me know if anything is missing from this issue, I'll do my best to provide more information as required.

@udoprog udoprog added the bug Something isn't working label Nov 24, 2024
@udoprog
Copy link
Collaborator

udoprog commented Nov 24, 2024

Thanks for the report!

It could be as simple as shebang stripping is accidentally not enabled for run.

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

No branches or pull requests

2 participants