Skip to content

Commit 1506351

Browse files
committed
[BugFix] WinPty can not launch applications with spaces in the path.
1 parent 8a0d506 commit 1506351

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Pty/WinPty.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,19 @@ bool WinPty::createProcess(QString command, const QString &arguments,
5454
errorString = tr("Winpty-agent.exe or winpty.dll not found!.");
5555
break;
5656
}
57+
command = command.trimmed();
58+
59+
if (command.startsWith("\"") && command.endsWith("\"")) {
60+
command.remove(command.length() - 1, 1);
61+
command.remove(0, 1);
62+
}
63+
5764
QString commandWithArguments = command;
5865

66+
if (commandWithArguments.contains(' ')) {
67+
commandWithArguments.prepend("\"").append("\"");
68+
}
69+
5970
if (arguments.isEmpty() == false) {
6071
commandWithArguments.append(" ").append(arguments);
6172
}

0 commit comments

Comments
 (0)