Commit 600127e8 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

fix quoting of strings with spaces and backslashes at the end

the regexp would match twice at the end, and thus insert a stray quote.
so use a discrete loop instead.
fixed the same thing in proparser/ioutils and consoleprocess before ...

Change-Id: I62b80fb4ea68e00145861f289bc13440c5078873

Reviewed-by: default avatarQt Sanity Bot <>
Reviewed-by: default avatarJoerg Bornemann <>
Reviewed-by: default avatarOswald Buddenhagen <>
parent 17623c87
......@@ -568,7 +568,10 @@ QString QtcProcess::quoteArg(const QString &arg)
// The argument must not end with a \ since this would be interpreted
// as escaping the quote -- rather put the \ behind the quote: e.g.
// rather use "foo"\ than "foo\"
ret.replace(QRegExp(QLatin1String("(\\\\*)$")), QLatin1String("\"\\1"));
int i = ret.length();
while (i > 0 && - 1) == QLatin1Char('\\'))
ret.insert(i, QLatin1Char('"'));
// FIXME: Without this, quoting is not foolproof. But it needs support in the process setup, etc.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment