forked from qt-creator/qt-creator
LinuxProcessImpl: Buffer standard error until started() is emitted
Change-Id: I1ee469a918ff95eeeb5038a4c2021469c429a269 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -493,6 +493,11 @@ void SshProcessInterface::handleReadyReadStandardOutput(const QByteArray &output
|
|||||||
emit readyRead(outputData, {});
|
emit readyRead(outputData, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SshProcessInterface::handleReadyReadStandardError(const QByteArray &errorData)
|
||||||
|
{
|
||||||
|
emit readyRead({}, errorData);
|
||||||
|
}
|
||||||
|
|
||||||
void SshProcessInterface::emitStarted(qint64 processId)
|
void SshProcessInterface::emitStarted(qint64 processId)
|
||||||
{
|
{
|
||||||
d->m_processId = processId;
|
d->m_processId = processId;
|
||||||
@@ -641,10 +646,20 @@ void LinuxProcessInterface::handleReadyReadStandardOutput(const QByteArray &outp
|
|||||||
|
|
||||||
emitStarted(processId);
|
emitStarted(processId);
|
||||||
|
|
||||||
if (!m_output.isEmpty())
|
if (!m_output.isEmpty() || !m_error.isEmpty())
|
||||||
emit readyRead(m_output, {});
|
emit readyRead(m_output, m_error);
|
||||||
|
|
||||||
m_output.clear();
|
m_output.clear();
|
||||||
|
m_error.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LinuxProcessInterface::handleReadyReadStandardError(const QByteArray &errorData)
|
||||||
|
{
|
||||||
|
if (m_pidParsed) {
|
||||||
|
emit readyRead({}, errorData);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_error.append(errorData);
|
||||||
}
|
}
|
||||||
|
|
||||||
SshProcessInterfacePrivate::SshProcessInterfacePrivate(SshProcessInterface *sshInterface,
|
SshProcessInterfacePrivate::SshProcessInterfacePrivate(SshProcessInterface *sshInterface,
|
||||||
@@ -721,12 +736,16 @@ void SshProcessInterfacePrivate::handleDone()
|
|||||||
|
|
||||||
void SshProcessInterfacePrivate::handleReadyReadStandardOutput()
|
void SshProcessInterfacePrivate::handleReadyReadStandardOutput()
|
||||||
{
|
{
|
||||||
q->handleReadyReadStandardOutput(m_process.readAllStandardOutput()); // by default emits signal. linux impl does custom parsing for processId and emits delayed start() - only when terminal is off
|
// By default emits signal. LinuxProcessImpl does custom parsing for processId
|
||||||
|
// and emits delayed start() - only when terminal is off.
|
||||||
|
q->handleReadyReadStandardOutput(m_process.readAllStandardOutput());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SshProcessInterfacePrivate::handleReadyReadStandardError()
|
void SshProcessInterfacePrivate::handleReadyReadStandardError()
|
||||||
{
|
{
|
||||||
emit q->readyRead({}, m_process.readAllStandardError());
|
// By default emits signal. LinuxProcessImpl buffers the error channel until
|
||||||
|
// it emits delayed start() - only when terminal is off.
|
||||||
|
q->handleReadyReadStandardError(m_process.readAllStandardError());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SshProcessInterfacePrivate::clearForStart()
|
void SshProcessInterfacePrivate::clearForStart()
|
||||||
|
@@ -45,10 +45,12 @@ private:
|
|||||||
|
|
||||||
void handleStarted(qint64 processId) final;
|
void handleStarted(qint64 processId) final;
|
||||||
void handleReadyReadStandardOutput(const QByteArray &outputData) final;
|
void handleReadyReadStandardOutput(const QByteArray &outputData) final;
|
||||||
|
void handleReadyReadStandardError(const QByteArray &errorData) final;
|
||||||
|
|
||||||
QString fullCommandLine(const Utils::CommandLine &commandLine) const final;
|
QString fullCommandLine(const Utils::CommandLine &commandLine) const final;
|
||||||
|
|
||||||
QByteArray m_output;
|
QByteArray m_output;
|
||||||
|
QByteArray m_error;
|
||||||
bool m_pidParsed = false;
|
bool m_pidParsed = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -51,6 +51,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
virtual void handleStarted(qint64 processId);
|
virtual void handleStarted(qint64 processId);
|
||||||
virtual void handleReadyReadStandardOutput(const QByteArray &outputData);
|
virtual void handleReadyReadStandardOutput(const QByteArray &outputData);
|
||||||
|
virtual void handleReadyReadStandardError(const QByteArray &errorData);
|
||||||
|
|
||||||
virtual QString fullCommandLine(const Utils::CommandLine &commandLine) const = 0;
|
virtual QString fullCommandLine(const Utils::CommandLine &commandLine) const = 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user