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

scala -version returns exitCode = 1 #8503

Closed
scabug opened this issue Apr 14, 2014 · 6 comments
Closed

scala -version returns exitCode = 1 #8503

scabug opened this issue Apr 14, 2014 · 6 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Apr 14, 2014

From the command line if I enter "scala -version" it returns with exitCode = 1, and outputs to stderr "Scala code runner version 2.10.3 -- Copyright 2002-2013, LAMP/EPFL"

Just asking that the version should not be an error.

@scabug
Copy link
Author

scabug commented Apr 14, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8503?orig=1
Reporter: Eric Kolotyluk (kolotyluk)
Affected Versions: 2.10.3

@scabug
Copy link
Author

scabug commented Apr 22, 2014

Michele Esposito (mresposito) said:
see PR: scala/scala#3691

@scabug
Copy link
Author

scabug commented Apr 22, 2014

@som-snytt said:
It seems to me that -version should behave the same as other info messages like -Xshow-phases or -help.

I would refactor -version to CompilerCommand to enforce that uniformity.

Then the question is whether the current behavior is useful. I'm not sure why scalac differs from the runner, but arguably scalac -version foo.scala && scala Foo means I think my file was recompiled if it is run. I just wanted to make sure I always use the correct version of the compiler.

Similarly, scala -Xshow-phases foo.scala && scala bar.scala just means I want to verify some info in the middle of the compound command.

Maybe it needs the equivalent of -Xfatal-warnings, such as -Xfatal-info for the current behavior.

@scabug
Copy link
Author

scabug commented Apr 22, 2014

Michele Esposito (mresposito) said:
I agree that -version should conform with -Xshow-phases and -help, and other additional comands. However, those also throw exitCode=1. And, as you have noted, also scalac -version throws exitCode=1.

So, what do you think this should be changed to? I think that the correct behaviour would be to output to stderr, but return no error code

@scabug
Copy link
Author

scabug commented Apr 22, 2014

@som-snytt said:
Just to clarify:

apm@mara:~$ scalac -version
Scala compiler version 2.10.4-RC3 -- Copyright 2002-2013, LAMP/EPFL
apm@mara:~$ echo $?
0
apm@mara:~$ scalacm -version
Scala compiler version 2.11.0-RC3 -- Copyright 2002-2013, LAMP/EPFL
apm@mara:~$ echo $?
0
apm@mara:~$ scalacm -version junk.scala
Scala compiler version 2.11.0-RC3 -- Copyright 2002-2013, LAMP/EPFL
apm@mara:~$ echo $?
0

The difference is:

apm@mara:~$ scalam -version
Scala code runner version 2.11.0-RC3 -- Copyright 2002-2013, LAMP/EPFL
apm@mara:~$ echo $?
1

My proposal was that you can request whether info messages result in a non-zero exit code.

@scabug
Copy link
Author

scabug commented May 29, 2014

@som-snytt said:
This version makes the info output uniformly exit code zero albeit output on stderr, consistent with java.

scala/scala#3800

@scabug scabug closed this as completed Jun 10, 2014
@scabug scabug added this to the 2.11.2 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants