1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

bug 261976: Console does NOT display quoted command line options.

This commit is contained in:
Andrew Gvozdev 2012-03-15 23:50:34 -04:00
parent a8f5e29bcb
commit 2137716456

View file

@ -254,11 +254,23 @@ public class CommandLauncher implements ICommandLauncher {
return state;
}
@SuppressWarnings("nls")
protected void printCommandLine(OutputStream os) {
if (os != null) {
String cmd = getCommandLine(getCommandArgs());
StringBuffer buf = new StringBuffer();
if (fCommandArgs != null) {
for (String commandArg : getCommandArgs()) {
if (commandArg.contains(" ") || commandArg.contains("\"") || commandArg.contains("\\")) {
commandArg = '"' + commandArg.replaceAll("\\\\", "\\\\\\\\").replaceAll("\"", "\\\\\"") + '"';
}
buf.append(commandArg);
buf.append(' ');
}
buf.append(lineSeparator);
}
try {
os.write(cmd.getBytes());
os.write(buf.toString().getBytes());
os.flush();
} catch (IOException e) {
// ignore;