forked from qt-creator/qt-creator
VCS: Enable terminating a command
Change-Id: I2160a22e300aca9b38e28257375c8e0be2026d12 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
0aae98fb13
commit
27e53f746f
@@ -402,6 +402,11 @@ SynchronousProcessResponse SynchronousProcess::run(const QString &binary,
|
||||
return d->m_result;
|
||||
}
|
||||
|
||||
bool SynchronousProcess::terminate()
|
||||
{
|
||||
return stopProcess(d->m_process);
|
||||
}
|
||||
|
||||
static inline bool askToKill(const QString &binary = QString())
|
||||
{
|
||||
if (!isGuiThread())
|
||||
|
||||
@@ -145,6 +145,9 @@ signals:
|
||||
void stdOutBuffered(const QString &data, bool firstTime);
|
||||
void stdErrBuffered(const QString &data, bool firstTime);
|
||||
|
||||
public slots:
|
||||
bool terminate();
|
||||
|
||||
private slots:
|
||||
void slotTimeout();
|
||||
void finished(int exitCode, QProcess::ExitStatus e);
|
||||
|
||||
@@ -213,6 +213,11 @@ void Command::execute()
|
||||
Core::ICore::progressManager()->addTask(task, taskName, binary + QLatin1String(".action"));
|
||||
}
|
||||
|
||||
void Command::terminate()
|
||||
{
|
||||
emit doTerminate();
|
||||
}
|
||||
|
||||
bool Command::lastExecutionSuccess() const
|
||||
{
|
||||
return d->m_lastExecSuccess;
|
||||
@@ -346,8 +351,8 @@ Utils::SynchronousProcessResponse Command::runVcs(const QStringList &arguments,
|
||||
if (d->m_flags & VcsBasePlugin::FullySynchronously) {
|
||||
response = runSynchronous(arguments, timeoutMS);
|
||||
} else {
|
||||
// Run, connect stderr to the output window
|
||||
Utils::SynchronousProcess process;
|
||||
connect(this, SIGNAL(doTerminate()), &process, SLOT(terminate()));
|
||||
if (!d->m_workingDirectory.isEmpty())
|
||||
process.setWorkingDirectory(d->m_workingDirectory);
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ public:
|
||||
void addJob(const QStringList &arguments);
|
||||
void addJob(const QStringList &arguments, int timeout);
|
||||
void execute();
|
||||
void terminate();
|
||||
bool lastExecutionSuccess() const;
|
||||
int lastExecutionExitCode() const;
|
||||
|
||||
@@ -118,6 +119,7 @@ signals:
|
||||
void errorText(const QString &);
|
||||
void finished(bool ok, int exitCode, const QVariant &cookie);
|
||||
void success(const QVariant &cookie);
|
||||
void doTerminate();
|
||||
|
||||
private:
|
||||
class Internal::CommandPrivate *const d;
|
||||
|
||||
Reference in New Issue
Block a user