Utils: Make process results accessible through QtcProcess object

The result is fully stored in the object anyway. Using the extra
SynchronousProcessResponse structure only causes copies of
the data and complicates access on the user side in
a lot of cases.

The result bits are now also accessible individually.

There's obvious room for follow-up changes on the topic, e.g.
ShellCommand::runCommand's parameter list could shrink to
just a SynchronousProcess parameter.

Change-Id: I45aa7eb23832340be06905929280c012e1217263
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2021-05-12 14:25:50 +02:00
parent f23b27ded6
commit 55f768e1b0
54 changed files with 747 additions and 706 deletions

View File

@@ -142,10 +142,11 @@ public:
// This is called once per job in a thread.
// When called from the UI thread it will execute fully synchronously, so no signals will
// be triggered!
virtual SynchronousProcessResponse runCommand(const CommandLine &command,
int timeoutS,
const QString &workingDirectory = QString(),
const ExitCodeInterpreter &interpreter = {});
virtual void runCommand(Utils::SynchronousProcess &process,
const CommandLine &command,
int timeoutS,
const QString &workingDirectory = QString(),
const ExitCodeInterpreter &interpreter = {});
void cancel();
@@ -167,15 +168,17 @@ private:
void run(QFutureInterface<void> &future);
// Run without a event loop in fully blocking mode. No signals will be delivered.
SynchronousProcessResponse runFullySynchronous(const CommandLine &cmd,
QSharedPointer<OutputProxy> proxy,
int timeoutS, const QString &workingDirectory,
const ExitCodeInterpreter &interpreter = {});
void runFullySynchronous(SynchronousProcess &proc,
const CommandLine &cmd,
QSharedPointer<OutputProxy> proxy,
int timeoutS, const QString &workingDirectory,
const ExitCodeInterpreter &interpreter = {});
// Run with an event loop. Signals will be delivered.
SynchronousProcessResponse runSynchronous(const CommandLine &cmd,
QSharedPointer<OutputProxy> proxy,
int timeoutS, const QString &workingDirectory,
const ExitCodeInterpreter &interpreter = {});
void runSynchronous(SynchronousProcess &proc,
const CommandLine &cmd,
QSharedPointer<OutputProxy> proxy,
int timeoutS, const QString &workingDirectory,
const ExitCodeInterpreter &interpreter = {});
class Internal::ShellCommandPrivate *const d;
};