Skip to content

fix for #11776 to correct handling of scalac -script target_script args #11777

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
Mar 23, 2021
Merged

fix for #11776 to correct handling of scalac -script target_script args #11777

merged 1 commit into from
Mar 23, 2021

Conversation

philwalk
Copy link
Contributor

The fix consists of this:

When -script target_script is first encountered, immediately transfer all remaining args to the script.
remove in_scripting_args

To verify the fix, I used these two scripts:
showargs.sc:

def main(args: Array[String]): Unit =
  for a <- args do
    println(s"[$a]")

hello.sc:

def main(args: Array[String]): Unit =
  println("hello!")

Command line to test for #11776:

$ scalac -script showargs.sc a b c -script hello.sc

Before the fix, the output would be:

$ hello!

With this fix, the output is:

[a]
[b]
[c]
[-script]
[hello.sc]

@anatoliykmetyuk anatoliykmetyuk merged commit 3d70c6c into scala:master Mar 23, 2021
@philwalk philwalk deleted the protect-scalac-script-args-fix-#11776 branch May 8, 2021 21: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.

scalac can consume arguments intended to be passed to a script, and can execute the wrong script
2 participants