Fix maxsplit-splitting with empty args (""/'').

Fixes #453.
This commit is contained in:
Florian Bruhin 2015-01-06 10:00:28 +01:00
parent e07146be7c
commit 46396cce1e

View File

@ -270,6 +270,9 @@ class CommandRunner(QObject):
maxsplit=maxsplit) maxsplit=maxsplit)
for s in args: for s in args:
# remove quotes and replace \" by " # remove quotes and replace \" by "
if s == '""' or s == "''":
s = ''
else:
s = re.sub(r"""(^|[^\\])["']""", r'\1', s) s = re.sub(r"""(^|[^\\])["']""", r'\1', s)
s = re.sub(r"""\\(["'])""", r'\1', s) s = re.sub(r"""\\(["'])""", r'\1', s)
self._args.append(s) self._args.append(s)