Utils: Workaround for slow data upload

The deviceshell script is slow to upload large amounts of stdin data.

Use QtcProcess directly if the size of the data exceeds 100kb.

Change-Id: Ide63bfd973d31f7f076ab7cd4be73cc85c9239ea
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Marcus Tillmanns
2022-10-27 08:01:52 +02:00
parent 86a24b707d
commit af0797f0cc

View File

@@ -74,8 +74,14 @@ QStringList DeviceShell::missingFeatures() const { return m_missingFeatures; }
RunResult DeviceShell::run(const CommandLine &cmd, const QByteArray &stdInData)
{
if (m_shellScriptState == State::NoScript) {
// Fallback ...
// If the script failed to install, use QtcProcess directly instead.
bool useProcess = m_shellScriptState == State::NoScript;
// Transferring large amounts of stdInData is slow via the shell script.
// Use QtcProcess directly if the size exceeds 100kb.
useProcess |= stdInData.size() > (1024 * 100);
if (useProcess) {
QtcProcess proc;
proc.setCommand(createFallbackCommand(cmd));
proc.setWriteData(stdInData);