forked from qt-creator/qt-creator
Revert "Utils: Replace SynchronousCommand::flags by a named bool"
This reverts commit c617632e4d9291f1b50ec0c7e1a914a6a689284e. To early, dependencies missing. Change-Id: I91433aebbaf2c04cbb212585deb3cde5f3208974 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -103,7 +103,6 @@ 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,
|
||||
@@ -225,6 +224,11 @@ void ShellCommand::cancel()
|
||||
emit terminate();
|
||||
}
|
||||
|
||||
unsigned ShellCommand::processFlags() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ShellCommand::addTask(QFuture<void> &future)
|
||||
{
|
||||
Q_UNUSED(future)
|
||||
@@ -353,8 +357,7 @@ SynchronousProcessResponse ShellCommand::runFullySynchronous(const CommandLine &
|
||||
{
|
||||
// Set up process
|
||||
SynchronousProcess process;
|
||||
if (d->m_disableUnixTerminal)
|
||||
process.setDisableUnixTerminal();
|
||||
process.setFlags(processFlags());
|
||||
const QString dir = workDirectory(workingDirectory);
|
||||
if (!dir.isEmpty())
|
||||
process.setWorkingDirectory(dir);
|
||||
@@ -398,8 +401,7 @@ SynchronousProcessResponse ShellCommand::runSynchronous(const CommandLine &cmd,
|
||||
process.setTimeoutS(timeoutS);
|
||||
if (d->m_codec)
|
||||
process.setCodec(d->m_codec);
|
||||
if (d->m_disableUnixTerminal)
|
||||
process.setDisableUnixTerminal();
|
||||
process.setFlags(processFlags());
|
||||
const QString dir = workDirectory(workingDirectory);
|
||||
if (!dir.isEmpty())
|
||||
process.setWorkingDirectory(dir);
|
||||
@@ -487,11 +489,6 @@ 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)
|
||||
{ }
|
||||
|
@@ -141,7 +141,6 @@ public:
|
||||
void setProgressiveOutput(bool progressive);
|
||||
|
||||
void setOutputProxyFactory(const std::function<OutputProxy *()> &factory);
|
||||
void setDisableUnixTerminal();
|
||||
|
||||
// This is called once per job in a thread.
|
||||
// When called from the UI thread it will execute fully synchronously, so no signals will
|
||||
@@ -163,6 +162,7 @@ signals:
|
||||
void terminate(); // Internal
|
||||
|
||||
protected:
|
||||
virtual unsigned processFlags() const;
|
||||
virtual void addTask(QFuture<void> &future);
|
||||
int timeoutS() const;
|
||||
QString workDirectory(const QString &wd) const;
|
||||
|
@@ -93,7 +93,8 @@ class TerminalControllingProcess : public QtcProcess
|
||||
public:
|
||||
TerminalControllingProcess();
|
||||
|
||||
void setDisableUnixTerminal() { m_disableUnixTerminal = true; }
|
||||
unsigned flags() const { return m_flags; }
|
||||
void setFlags(unsigned tc) { m_flags = tc; }
|
||||
|
||||
protected:
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
@@ -103,7 +104,7 @@ protected:
|
||||
private:
|
||||
void setupChildProcess_impl();
|
||||
|
||||
bool m_disableUnixTerminal = false;
|
||||
unsigned m_flags = 0;
|
||||
};
|
||||
|
||||
TerminalControllingProcess::TerminalControllingProcess()
|
||||
@@ -124,7 +125,7 @@ void TerminalControllingProcess::setupChildProcess_impl()
|
||||
{
|
||||
#ifdef Q_OS_UNIX
|
||||
// Disable terminal by becoming a session leader.
|
||||
if (m_disableUnixTerminal)
|
||||
if (m_flags & SynchronousProcess::UnixTerminalDisabled)
|
||||
setsid();
|
||||
#endif
|
||||
}
|
||||
@@ -409,9 +410,14 @@ void SynchronousProcess::setEnvironment(const Environment &e)
|
||||
d->m_process.setEnvironment(Environment(e));
|
||||
}
|
||||
|
||||
void SynchronousProcess::setDisableUnixTerminal()
|
||||
unsigned SynchronousProcess::flags() const
|
||||
{
|
||||
d->m_process.setDisableUnixTerminal();
|
||||
return d->m_process.flags();
|
||||
}
|
||||
|
||||
void SynchronousProcess::setFlags(unsigned tc)
|
||||
{
|
||||
d->m_process.setFlags(tc);
|
||||
}
|
||||
|
||||
void SynchronousProcess::setExitCodeInterpreter(const ExitCodeInterpreter &interpreter)
|
||||
|
@@ -85,6 +85,11 @@ class QTCREATOR_UTILS_EXPORT SynchronousProcess : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Flags {
|
||||
// Unix: Do not give the child process a terminal for input prompting.
|
||||
UnixTerminalDisabled = 0x1
|
||||
};
|
||||
|
||||
SynchronousProcess();
|
||||
~SynchronousProcess() override;
|
||||
|
||||
@@ -114,8 +119,8 @@ public:
|
||||
void setWorkingDirectory(const QString &workingDirectory);
|
||||
QString workingDirectory() const;
|
||||
|
||||
// Unix: Do not give the child process a terminal for input prompting.
|
||||
void setDisableUnixTerminal();
|
||||
unsigned flags() const;
|
||||
void setFlags(unsigned);
|
||||
|
||||
void setExitCodeInterpreter(const ExitCodeInterpreter &interpreter);
|
||||
ExitCodeInterpreter exitCodeInterpreter() const;
|
||||
|
@@ -200,7 +200,7 @@ static FilePath qmakeFromCMakeCache(const CMakeConfig &config)
|
||||
|
||||
SynchronousProcess cmake;
|
||||
cmake.setTimeoutS(5);
|
||||
cmake.setDisableUnixTerminal();
|
||||
cmake.setFlags(SynchronousProcess::UnixTerminalDisabled);
|
||||
Environment env = Environment::systemEnvironment();
|
||||
Environment::setupEnglishOutput(&env);
|
||||
cmake.setEnvironment(env);
|
||||
|
@@ -193,7 +193,7 @@ Utils::SynchronousProcessResponse CMakeTool::run(const QStringList &args, int ti
|
||||
{
|
||||
Utils::SynchronousProcess cmake;
|
||||
cmake.setTimeoutS(timeoutS);
|
||||
cmake.setDisableUnixTerminal();
|
||||
cmake.setFlags(Utils::SynchronousProcess::UnixTerminalDisabled);
|
||||
Utils::Environment env = Utils::Environment::systemEnvironment();
|
||||
Utils::Environment::setupEnglishOutput(&env);
|
||||
cmake.setEnvironment(env);
|
||||
|
@@ -41,7 +41,6 @@ VcsCommand::VcsCommand(const QString &workingDirectory, const Environment &envir
|
||||
m_preventRepositoryChanged(false)
|
||||
{
|
||||
VcsOutputWindow::setRepository(workingDirectory);
|
||||
setDisableUnixTerminal();
|
||||
setOutputProxyFactory([this] {
|
||||
auto proxy = new OutputProxy;
|
||||
VcsOutputWindow *outputWindow = VcsOutputWindow::instance();
|
||||
@@ -95,6 +94,14 @@ void VcsCommand::emitRepositoryChanged(const QString &workingDirectory)
|
||||
Core::VcsManager::emitRepositoryChanged(workDirectory(workingDirectory));
|
||||
}
|
||||
|
||||
unsigned VcsCommand::processFlags() const
|
||||
{
|
||||
unsigned processFlags = 0;
|
||||
if (!VcsBase::sshPrompt().isEmpty() && (flags() & SshPasswordPrompt))
|
||||
processFlags |= SynchronousProcess::UnixTerminalDisabled;
|
||||
return processFlags;
|
||||
}
|
||||
|
||||
void VcsCommand::coreAboutToClose()
|
||||
{
|
||||
m_preventRepositoryChanged = true;
|
||||
|
@@ -51,6 +51,7 @@ public:
|
||||
const Utils::ExitCodeInterpreter &interpreter = Utils::defaultExitCodeInterpreter) override;
|
||||
|
||||
private:
|
||||
unsigned processFlags() const override;
|
||||
void emitRepositoryChanged(const QString &workingDirectory);
|
||||
|
||||
void coreAboutToClose() override;
|
||||
|
Reference in New Issue
Block a user