Skip to content

Commit

Permalink
Issue #232: Linux connector cli not functioning locally
Browse files Browse the repository at this point in the history
  • Loading branch information
SafaeAJ committed Jun 12, 2024
1 parent b7534f2 commit 19c46d4
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,15 @@ public static String runLocalCommand(
) throws InterruptedException, IOException, TimeoutException {
isTrue(timeout > 0, NEGATIVE_TIMEOUT);

final String cmd = LocalOsHandler.isWindows() ? "CMD.EXE /C " + command : command;
final ProcessBuilder builder = new ProcessBuilder();
if (LocalOsHandler.isWindows()) {
builder.command(System.getenv("ComSpec"), "/C", command);
} else {
builder.command(System.getenv("SHELL"), "-c", command);
}

final Process process = builder.start();

final Process process = Runtime.getRuntime().exec(cmd);
if (process == null) {
throw new IllegalStateException("Local command Process is null.");
}
Expand Down

0 comments on commit 19c46d4

Please sign in to comment.