Skip to content

scala script exit code should be non-0 for missing parameters #16040

Open
@mpollmeier

Description

@mpollmeier

Compiler version

3.2.0

Minimized code

fun.sc:

@main def fun(i: Int): Unit = {
  println("foo")
}
scala fun.sc
echo $?

Output

Illegal command line: more arguments expected
0

Expectation

The exit code of the process should not be 0, so that the usage side can infer that an error happened. For reference, if the main method contains code that throws an exception, the exit code is 1.

Initial Analysis

CommandLineParser throws a ParserError, which is caught by the handler that MainProxies generates here, as documented here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions