diff --git a/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/CommandUtils.scala b/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/CommandUtils.scala index 3874bd3191a338464286ed33fbf8881e67484755..e724fb0e4e3641b8ae52489a64434a0bf09d029c 100644 --- a/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/CommandUtils.scala +++ b/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/CommandUtils.scala @@ -20,6 +20,7 @@ package com.streamxhub.streamx.common.util import java.io._ import java.lang.{Iterable => JavaIter} +import java.util import java.util.Scanner import java.util.function.Consumer import scala.collection.JavaConversions._ @@ -65,7 +66,7 @@ object CommandUtils extends Logger { logDebug(s"Command execute:\n${commands.mkString("\n")} ") val process = Utils.isWindows match { case x if x => Runtime.getRuntime.exec("cmd /k ", null, null) - case _ => Runtime.getRuntime.exec("/bin/bash ", null, null) + case _ => new ProcessBuilder(util.Arrays.asList("/bin/bash")).redirectErrorStream(true).start } val out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(process.getOutputStream)), true) commands.foreach(out.println)