chuck does not ignore the shebang in the first line
Hi there! Love what you're doing with chuck; I just ran into a small paper cut that I wanted to flag.
Summary
When a .ck file starts with a #! shebang line, chuck throws a syntax error instead of ignoring it. This makes it impossible to use .ck files as directly executable scripts on Unix.
Environment
- chuck version: 1.5.5.8-dev (chai)
- Platform: Linux x86_64
Steps to reproduce
- Create a file
hello.ck:
#!/usr/local/bin/chuck
<<<"Hello World!">>>;
- Run it:
chuck -s hello.ck
- Result:
hello.ck:1:1: syntax error
[1] #!/usr/local/bin/chuck
^
Expected behavior
chuck should ignore a #! line at the start of a file, so that .ck scripts can be made executable:
chmod +x hello.ck
./hello.ck
This is standard practice for interpreted languages. Node.js, for example, also uses // for comments and not #, but still skips a leading #! line.
Since #! is already a syntax error in chuck, ignoring it on the first line is a safe, non-breaking change that has no effect on existing valid .ck files.
Hm, i think i might have gotten this wrong anyhow. Since chuck does not read a script on stdin per default, this might not even work if the shebang is ignored. So i guess this is actually not a way to go. But maybe there would be a way to get it to read scripts? Then it would be necessary?