From af0797f0cc481e54438034b4aafe071a9e286fd4 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Thu, 27 Oct 2022 08:01:52 +0200 Subject: [PATCH] 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 --- src/libs/utils/deviceshell.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libs/utils/deviceshell.cpp b/src/libs/utils/deviceshell.cpp index 4cd8642ec0f..1d4aef5273c 100644 --- a/src/libs/utils/deviceshell.cpp +++ b/src/libs/utils/deviceshell.cpp @@ -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);