Skip to content

Commit b458322

Browse files
committed
U
1 parent f635178 commit b458322

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

src/main/java/io/github/fvarrui/javapackager/utils/CommandUtils.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import org.apache.commons.lang3.SystemUtils;
1010
import org.apache.maven.plugin.MojoExecutionException;
1111
import org.codehaus.plexus.util.cli.CommandLineException;
12-
import org.codehaus.plexus.util.cli.Commandline;
1312

1413
public class CommandUtils {
1514

@@ -52,21 +51,18 @@ public static String execute(File workingDirectory, String executable, Object...
5251

5352
Commandline command = new Commandline();
5453
command.setWorkingDirectory(workingDirectory);
54+
command.setExecutable(executable);
55+
command.getShell().setQuotedArgumentsEnabled(false);
5556

5657
if (SystemUtils.IS_OS_WINDOWS) {
57-
command.setExecutable(executable);
5858
command.getShell().setShellArgs(new String[] { "/s", "/c" } );
59-
command.getShell().setQuotedArgumentsEnabled(false);
60-
createArguments(command, arguments);
6159
} else {
62-
Commandline bash = new Commandline();
63-
bash.setExecutable(executable);
64-
createArguments(bash, arguments);
65-
command.setExecutable("/bin/bash");
66-
command.createArg().setValue("-c");
67-
command.createArg().setValue("\"" + StringUtils.join(bash.getCommandline(), " ") + "\"");
60+
command.getShell().setShellArgs(new String[] { "-c" } );
6861
}
62+
63+
createArguments(command, arguments);
6964

65+
Logger.info("Shell: " + command.getShell().getShellCommand());
7066
Logger.info("Executing command: " + StringUtils.join(command.getCommandline(), " "));
7167

7268
Process process = command.execute();
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package io.github.fvarrui.javapackager.utils;
2+
3+
public class Commandline extends org.codehaus.plexus.util.cli.Commandline {
4+
5+
public String[] getCommandline()
6+
{
7+
return getShellCommandline();
8+
}
9+
10+
}

0 commit comments

Comments
 (0)