Fix external version command

This commit is contained in:
Paul Schaub 2023-01-12 16:04:44 +01:00
parent 951cf9cbca
commit bd02b11944

View file

@ -31,10 +31,10 @@ public class VersionExternal implements Version {
Process process = runtime.exec(command, env); Process process = runtime.exec(command, env);
BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream())); BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line = stdInput.readLine().trim(); String line = stdInput.readLine().trim();
ExternalSOP.finish(process);
if (line.contains(" ")) { if (line.contains(" ")) {
return line.substring(0, line.lastIndexOf(" ")); return line.substring(0, line.lastIndexOf(" "));
} }
ExternalSOP.finish(process);
return line; return line;
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@ -49,10 +49,10 @@ public class VersionExternal implements Version {
Process process = runtime.exec(command, env); Process process = runtime.exec(command, env);
BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream())); BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line = stdInput.readLine().trim(); String line = stdInput.readLine().trim();
ExternalSOP.finish(process);
if (line.contains(" ")) { if (line.contains(" ")) {
return line.substring(line.lastIndexOf(" ") + 1); return line.substring(line.lastIndexOf(" ") + 1);
} }
ExternalSOP.finish(process);
return line; return line;
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);