forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/10.0'
Conflicts: cmake/QtCreatorIDEBranding.cmake qbs/modules/qtc/qtc.qbs src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp src/tools/perfparser Change-Id: Ie5643100e0eb00e0933359dce320169b876f5634
This commit is contained in:
@@ -62,7 +62,6 @@ DeviceShell::~DeviceShell()
|
||||
*/
|
||||
RunResult DeviceShell::runInShell(const CommandLine &cmd, const QByteArray &stdInData)
|
||||
{
|
||||
QTC_ASSERT(m_shellProcess, return {});
|
||||
Q_ASSERT(QThread::currentThread() != &m_thread);
|
||||
|
||||
return run(cmd, stdInData);
|
||||
@@ -75,7 +74,7 @@ QStringList DeviceShell::missingFeatures() const { return m_missingFeatures; }
|
||||
RunResult DeviceShell::run(const CommandLine &cmd, const QByteArray &stdInData)
|
||||
{
|
||||
// If the script failed to install, use QtcProcess directly instead.
|
||||
bool useProcess = m_shellScriptState == State::NoScript;
|
||||
bool useProcess = m_shellScriptState == State::Failed;
|
||||
|
||||
// Transferring large amounts of stdInData is slow via the shell script.
|
||||
// Use QtcProcess directly if the size exceeds 100kb.
|
||||
@@ -198,10 +197,7 @@ bool DeviceShell::start()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!installShellScript()) {
|
||||
if (m_shellScriptState == State::FailedToStart)
|
||||
closeShellProcess();
|
||||
} else {
|
||||
if (installShellScript()) {
|
||||
connect(m_shellProcess.get(),
|
||||
&QtcProcess::readyReadStandardOutput,
|
||||
m_shellProcess.get(),
|
||||
@@ -214,6 +210,10 @@ bool DeviceShell::start()
|
||||
qCWarning(deviceShellLog)
|
||||
<< "Received unexpected output on stderr:" << stdErr;
|
||||
});
|
||||
} else if (m_shellProcess->isRunning()) {
|
||||
m_shellProcess->kill();
|
||||
m_shellProcess.reset();
|
||||
return false;
|
||||
}
|
||||
|
||||
connect(m_shellProcess.get(), &QtcProcess::done, m_shellProcess.get(), [this] {
|
||||
@@ -248,7 +248,7 @@ bool DeviceShell::checkCommand(const QByteArray &command)
|
||||
}
|
||||
QByteArray out = m_shellProcess->readAllRawStandardOutput();
|
||||
if (out.contains("<missing>")) {
|
||||
m_shellScriptState = State::NoScript;
|
||||
m_shellScriptState = State::Failed;
|
||||
qCWarning(deviceShellLog) << "Command" << command << "was not found";
|
||||
m_missingFeatures.append(QString::fromUtf8(command));
|
||||
return false;
|
||||
@@ -260,7 +260,7 @@ bool DeviceShell::checkCommand(const QByteArray &command)
|
||||
bool DeviceShell::installShellScript()
|
||||
{
|
||||
if (m_forceFailScriptInstallation) {
|
||||
m_shellScriptState = State::NoScript;
|
||||
m_shellScriptState = State::Failed;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -291,15 +291,19 @@ bool DeviceShell::installShellScript()
|
||||
}
|
||||
|
||||
QByteArray out = m_shellProcess->readAllRawStandardError();
|
||||
if (out.contains("SCRIPT_INSTALLED")) {
|
||||
if (out.contains("SCRIPT_INSTALLED") && !out.contains("ERROR_INSTALL_SCRIPT")) {
|
||||
m_shellScriptState = State::Succeeded;
|
||||
return true;
|
||||
}
|
||||
if (out.contains("ERROR_INSTALL_SCRIPT")) {
|
||||
m_shellScriptState = State::NoScript;
|
||||
m_shellScriptState = State::Failed;
|
||||
qCWarning(deviceShellLog) << "Failed installing device shell script";
|
||||
return false;
|
||||
}
|
||||
if (!out.isEmpty()) {
|
||||
qCWarning(deviceShellLog)
|
||||
<< "Unexpected output while installing device shell script:" << out;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user