ShellCommand: Introduce CommandResult structure

Don't require QtcProcess instance when calling
ShellCommand::runCommand().

Change-Id: Ie0287d91c1807465eab12be7eaa2eac561179af7
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2022-07-29 14:41:15 +02:00
parent 278f33d521
commit 0a1ac481ed
13 changed files with 354 additions and 397 deletions

View File

@@ -1666,20 +1666,18 @@ ClearCasePluginPrivate::runCleartool(const FilePath &workingDir,
return response;
}
QtcProcess proc;
proc.setTimeoutS(timeOutS);
auto *command = VcsBaseClient::createVcsCommand(workingDir, Environment::systemEnvironment());
command->addFlags(flags);
command->setCodec(outputCodec);
command->runCommand(proc, {FilePath::fromString(executable), arguments});
const CommandResult result = command->runCommand({FilePath::fromString(executable), arguments},
workingDir, timeOutS);
delete command;
response.error = proc.result() != ProcessResult::FinishedWithSuccess;
response.error = result.result() != ProcessResult::FinishedWithSuccess;
if (response.error)
response.message = proc.exitMessage();
response.stdErr = proc.cleanedStdErr();
response.stdOut = proc.cleanedStdOut();
response.message = result.exitMessage();
response.stdErr = result.cleanedStdErr();
response.stdOut = result.cleanedStdOut();
return response;
}