From 97eb094114c9e43e1e6b577fd2e112f15a4673d6 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 15 Feb 2021 22:16:09 +0100 Subject: [PATCH] fix for unix systems --- .../sloeber/core/tools/ExternalCommandLauncher.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/io.sloeber.core/src/io/sloeber/core/tools/ExternalCommandLauncher.java b/io.sloeber.core/src/io/sloeber/core/tools/ExternalCommandLauncher.java index 4d9b7c4ac..b829c9cbd 100644 --- a/io.sloeber.core/src/io/sloeber/core/tools/ExternalCommandLauncher.java +++ b/io.sloeber.core/src/io/sloeber/core/tools/ExternalCommandLauncher.java @@ -151,6 +151,19 @@ public ExternalCommandLauncher(String command) { this.myRunLock = this; String[] commandParts = command .split(" +(?=([^\"]*\"[^\"]*\")*[^\"]*$)"); //$NON-NLS-1$ + // Remove quotes for Unix systems + String os = System.getProperty("os.name").toLowerCase(); + if(os.indexOf("nix") >= 0 || + os.indexOf("nux") >= 0 || + os.indexOf("aix") > 0) { + for (int curCommand = 0; curCommand < commandParts.length; curCommand++) { + if (commandParts[curCommand].startsWith("\"") //$NON-NLS-1$ + && commandParts[curCommand].endsWith("\"")) { //$NON-NLS-1$ + commandParts[curCommand] = commandParts[curCommand].substring(1, + commandParts[curCommand].length() - 1); + } + } + } myProcessBuilder = new ProcessBuilder(Arrays.asList(commandParts)); myProcessBuilder.redirectErrorStream(true);