rune icon indicating copy to clipboard operation
rune copied to clipboard

error: Expected expression but got a shebang

Open karaiwulf opened this issue 11 months ago • 1 comments

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.

karaiwulf avatar Nov 23 '24 02:11 karaiwulf