Skip to content

chuck does not ignore the shebang in the first line #545

@mkbrechtel

Description

@mkbrechtel

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

  1. Create a file hello.ck:
#!/usr/local/bin/chuck
<<<"Hello World!">>>;
  1. Run it:
chuck -s hello.ck
  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions