Skip to content
Snippets Groups Projects
Commit a1dc1ed7 authored by Lukasz Lopatowski's avatar Lukasz Lopatowski
Browse files

Merge branch '307-alter-way-shell-commands-are-run' into 'develop'

Altering the way bash commands are run

See merge request !277
parents 43a052e7 580418d6
No related branches found
No related tags found
1 merge request!277Altering the way bash commands are run
Pipeline #95508 passed
...@@ -25,7 +25,7 @@ public class DefaultCommandExecutor implements CommandExecutor { ...@@ -25,7 +25,7 @@ public class DefaultCommandExecutor implements CommandExecutor {
private String executeInternal(Command command) throws CommandExecutionException { private String executeInternal(Command command) throws CommandExecutionException {
try { try {
log.info("Executing: {}", command.asString()); log.info("Executing: {}", command.asString());
Process process = new ProcessBuilder(new String[]{"bash", "-c", command.asString()}).start(); Process process = new ProcessBuilder(new String[]{"sh", "-c", command.asString()}).start();
final String errorOutput = new String(process.getErrorStream().readAllBytes(), StandardCharsets.UTF_8); final String errorOutput = new String(process.getErrorStream().readAllBytes(), StandardCharsets.UTF_8);
if (Strings.isNotEmpty(errorOutput)) { if (Strings.isNotEmpty(errorOutput)) {
throw new CommandExecutionException("Error received during command execution (details: " + errorOutput + ")"); throw new CommandExecutionException("Error received during command execution (details: " + errorOutput + ")");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment