[BugFix] WinPty can not launch applications with spaces in the path.

This commit is contained in:
KingToolbox 2020-09-19 01:07:12 +08:00
parent 8a0d506c52
commit 150635107e

View File

@ -54,8 +54,19 @@ bool WinPty::createProcess(QString command, const QString &arguments,
errorString = tr("Winpty-agent.exe or winpty.dll not found!.");
break;
}
command = command.trimmed();
if (command.startsWith("\"") && command.endsWith("\"")) {
command.remove(command.length() - 1, 1);
command.remove(0, 1);
}
QString commandWithArguments = command;
if (commandWithArguments.contains(' ')) {
commandWithArguments.prepend("\"").append("\"");
}
if (arguments.isEmpty() == false) {
commandWithArguments.append(" ").append(arguments);
}