Utils: Replace SynchronousCommand::flags by a named bool

The potential extensibility was never used, and a similar use case
in QtcProcess (setLowPriority()) used a named setter.

Change-Id: I77d84ea2206995d5069265f8df78f40cf2ba8a36
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2021-05-05 15:23:34 +02:00
parent 40e2bb2551
commit 9a7a0098a3
8 changed files with 21 additions and 37 deletions

View File

@@ -103,6 +103,7 @@ public:
bool m_progressiveOutput = false;
bool m_hadOutput = false;
bool m_aborted = false;
bool m_disableUnixTerminal = false;
};
ShellCommandPrivate::Job::Job(const QString &wd, const CommandLine &command,
@@ -224,11 +225,6 @@ void ShellCommand::cancel()
emit terminate();
}
unsigned ShellCommand::processFlags() const
{
return 0;
}
void ShellCommand::addTask(QFuture<void> &future)
{
Q_UNUSED(future)
@@ -357,7 +353,8 @@ SynchronousProcessResponse ShellCommand::runFullySynchronous(const CommandLine &
{
// Set up process
SynchronousProcess process;
process.setFlags(processFlags());
if (d->m_disableUnixTerminal)
process.setDisableUnixTerminal();
const QString dir = workDirectory(workingDirectory);
if (!dir.isEmpty())
process.setWorkingDirectory(dir);
@@ -401,7 +398,8 @@ SynchronousProcessResponse ShellCommand::runSynchronous(const CommandLine &cmd,
process.setTimeoutS(timeoutS);
if (d->m_codec)
process.setCodec(d->m_codec);
process.setFlags(processFlags());
if (d->m_disableUnixTerminal)
process.setDisableUnixTerminal();
const QString dir = workDirectory(workingDirectory);
if (!dir.isEmpty())
process.setWorkingDirectory(dir);
@@ -489,6 +487,11 @@ void ShellCommand::setOutputProxyFactory(const std::function<OutputProxy *()> &f
d->m_proxyFactory = factory;
}
void ShellCommand::setDisableUnixTerminal()
{
d->m_disableUnixTerminal = true;
}
ProgressParser::ProgressParser() :
m_futureMutex(new QMutex)
{ }