VcsCommand: Make runCommand() a static method

And rename it to runBlocking() in order to conform
a bit more to QtcProcess API.

In case of blocking run there is no need to instantiate
VcsCommand on user side. This nicely draw a line between
async usages (i.e. when start() is called and we need
an instance) and blocking ones (i.e. when runBlocking()
is called).

Change-Id: I1ba94ee36c92956d5044236cb9e2dd896bf3cfcf
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2022-10-05 12:38:09 +02:00
parent 688ec935cd
commit 7591b2f56d
4 changed files with 23 additions and 15 deletions

View File

@@ -113,7 +113,10 @@ public:
void setProgressParser(ProgressParser *parser);
void setProgressiveOutput(bool progressive);
CommandResult runCommand(const Utils::CommandLine &command, int timeoutS = 10);
static CommandResult runBlocking(const Utils::FilePath &workingDirectory,
const Utils::Environment &environmentconst,
const Utils::CommandLine &command, unsigned flags,
int timeoutS, QTextCodec *codec);
void cancel();
QString cleanedStdOut() const;
@@ -134,6 +137,7 @@ signals:
void runCommandFinished(const Utils::FilePath &workingDirectory);
private:
CommandResult runBlockingHelper(const Utils::CommandLine &command, int timeoutS);
void postRunCommand(const Utils::FilePath &workingDirectory);
class Internal::VcsCommandPrivate *const d;