Utils: Integrate ptyqt into qtcprocess

Integrating PtyQt directly into QtcProcess allows us to
start Pseudo terminal processes using the existing QtcProcess
functionality such as starting remote process on e.g. docker
or remote linux devices.

This is needed for the new Terminal plugin.

Change-Id: Iaeed5ff9b341ba4646d955b2ed9577a18cd7100f
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-03-01 08:15:58 +01:00
parent 8b09ad8898
commit 1da18a4b62
12 changed files with 168 additions and 59 deletions

View File

@@ -656,9 +656,15 @@ void LinuxProcessInterface::handleReadyReadStandardOutput(const QByteArray &outp
m_output.append(outputData);
static const QByteArray endMarker = s_pidMarker + '\n';
const int endMarkerOffset = m_output.indexOf(endMarker);
if (endMarkerOffset == -1)
return;
int endMarkerLength = endMarker.length();
int endMarkerOffset = m_output.indexOf(endMarker);
if (endMarkerOffset == -1) {
static const QByteArray endMarker = s_pidMarker + "\r\n";
endMarkerOffset = m_output.indexOf(endMarker);
endMarkerLength = endMarker.length();
if (endMarkerOffset == -1)
return;
}
const int startMarkerOffset = m_output.indexOf(s_pidMarker);
if (startMarkerOffset == endMarkerOffset) // Only theoretically possible.
return;
@@ -668,7 +674,7 @@ void LinuxProcessInterface::handleReadyReadStandardOutput(const QByteArray &outp
const qint64 processId = pidString.toLongLong();
// We don't want to show output from e.g. /etc/profile.
m_output = m_output.mid(endMarkerOffset + endMarker.length());
m_output = m_output.mid(endMarkerOffset + endMarkerLength);
emitStarted(processId);