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

Add default output path for --compile (-c) #1472

Merged

Conversation

Andriamanitra
Copy link
Contributor

@Andriamanitra Andriamanitra commented Jul 8, 2024

Changes behavior of -c flag such that:

  • janet -c foo.janet writes to foo.jimage
  • janet -c foo writes to foo.jimage

Previously these would cause a confusing error due to out of bounds access to the args array (see #1451).

The default is only used if there are no more arguments after the input file – I didn't add any special handling for edge cases like janet -c foo.janet -h (which uses '-h' as the output file).

closes #1451

@sogaiu
Copy link
Contributor

sogaiu commented Jul 8, 2024

Gave the changes a try.

Both invocations seemed to work 👍

When a file named foo did not exist I got an error like:

error: could not find file foo
  in dofile [boot.janet] on line 2966, column 5
  in c-switch [boot.janet] (tail call) on line 4477, column 19
  in cli-main [boot.janet] on line 4520, column 13

which seemed helpful.

@bakpakin bakpakin merged commit 31f0ff0 into janet-lang:master Jul 8, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

janet -c source with missing output files should give informative error message
3 participants