-
Notifications
You must be signed in to change notification settings - Fork 10
Conversation
The command `javac -version` prints result to stderr when JAVA 8 is used and to stdout when JAVA 9 is used. Current check in CLI uses the stderr output, so when JAVA 9 is installed it fails to detect the correct version. In order to support both JAVA 8 and JAVA 9, capture both stdout and stderr and get the version from there. Also remove unneeded check for Java version - we care about JAVA Compiler, which is included in JDK.
}); | ||
|
||
it("returns correct javac version when it is printed on stdout (Java 9)", () => { | ||
return verifyJavaCompilerVersion("9.0.1", "stdout"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rosen-vladimirov some distributions of java return 9
when java -version
is called, in which case I think the regex might break. I haven't tested it but I encountered such an issue in the past.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this. In case 9 is returned, the current code will work fine, but this one will fail. I'll handle the case there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Plamen5kov fixed in this PR NativeScript/nativescript-cli#3294
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rosen-vladimirov I tested it, and CLI provides a message to install java 1.8.0.
Improve `appendZeroesToVersion` method to return the passed value in case it is null, undefined or empty string and add tests for the method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks all right to me
The command
javac -version
prints result to stderr when JAVA 8 is used and to stdout when JAVA 9 is used. Current check in CLI uses the stderr output, so when JAVA 9 is installed it fails to detect the correct version.In order to support both JAVA 8 and JAVA 9, capture both stdout and stderr and get the version from there.
Also remove unneeded check for Java version - we care about JAVA Compiler, which is included in JDK.