compilation fix.

This commit is contained in:
Kirill Likhodedov
2010-11-17 11:14:28 +03:00
parent b49cec6d7b
commit 4fe19342a1
@@ -41,7 +41,7 @@ final class ShellCommand {
// run via bash -cl <hg command> => need to escape bash special symbols
// '-l' makes bash execute as a login shell thus reading .bash_profile
String hgCommand = StringUtil.join(commandLine, " ");
hgCommand = StringUtil.escapeStringCharacters(hgCommand.length(), hgCommand, "\b\t\n\f\r|>$\"'&", false, false, new StringBuilder()).toString(); // we don't escape backslash, because we want special unicode characters (\u0017 for hg log)
hgCommand = escapeBashControlCharacters(hgCommand);
commandLine = new ArrayList<String>(3);
commandLine.add("bash");
commandLine.add("-cl");
@@ -98,4 +98,16 @@ final class ShellCommand {
return readingThread;
}
private static String escapeBashControlCharacters(String source) {
String bashControlChars = "\b\t\n\f\r|>$\"'&";
StringBuilder sb = new StringBuilder();
for (int i = 0; i < source.length(); i++) {
char ch = source.charAt(i);
if (bashControlChars.indexOf(ch) > -1) {
sb.append("\\").append(ch);
}
}
return sb.toString();
}
}