Skip to content

fix for capturing script args as soon as script file is detected #12467

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

Merged
merged 1 commit into from
May 13, 2021
Merged

fix for capturing script args as soon as script file is detected #12467

merged 1 commit into from
May 13, 2021

Conversation

philwalk
Copy link
Contributor

This fixes 2 issues:

  1. rename mispelled array scripting_args to script_args
  2. capture potentially lost scripting args

An example of the 2nd issue would be if a script expects arguments -script, '-repl, '-run, etc.
Here's a script that prints all arguments, and what it should print.

scala showargs.sc a b c -repl -run -script -debug
arg  0:[a]
arg  1:[b]
arg  2:[c]
arg  3:[-repl]
arg  4:[-run]
arg  5:[-script]
arg  6:[-debug]

Here's the same script called via scalac -script:

$ scalac -script ssrc/showargs.sc a b c -run -repl -script
arg  0:[a]
arg  1:[b]
arg  2:[c]
arg  3:[-repl]
arg  4:[-run]
arg  5:[-script]
arg  6:[-debug]

Two tests were added, one for each of these two cases.

@philwalk philwalk requested a review from liufengyun May 13, 2021 19:43
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@liufengyun liufengyun enabled auto-merge May 13, 2021 19:49
@liufengyun liufengyun merged commit b9773d6 into scala:master May 13, 2021
@philwalk philwalk deleted the fix-scripting-args-with-tests branch May 14, 2021 12:59
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.

2 participants