Skip to content

Commit

Permalink
Fix bug that slipped in in b5dd9e2
Browse files Browse the repository at this point in the history
Apparently `--version` outputs properly to stdout, while `-version` outputs to stderr for some reason...
I guess if I keep using `-version`, it's not necessary to catch and work with the stdout at all..?
We'll see how it goes.
  • Loading branch information
TechnicJelle committed Sep 19, 2024
1 parent ab96d61 commit 158dbc5
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/main_menu/java/util_for_checking_java_path_version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ Future<int> checkJavaVersion(String javaPath) async {
try {
ProcessResult jv = await Process.run(javaPath, ["-version"]);
final int exitCode = jv.exitCode;
final String stdout = jv.stdout;
final String stderr = jv.stderr;

if (exitCode != 0) {
throw "Process exited with $exitCode.\n$stderr";
}

RegExp r = RegExp(r"\d+");
final Match? match = r.firstMatch(stdout);
final Match? match = r.firstMatch(stderr);
if (match == null) {
throw "Version message did not contain a version number.";
}
Expand Down

0 comments on commit 158dbc5

Please sign in to comment.