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;
|
return d->m_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SynchronousProcess::terminate()
|
||||||
|
{
|
||||||
|
return stopProcess(d->m_process);
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool askToKill(const QString &binary = QString())
|
static inline bool askToKill(const QString &binary = QString())
|
||||||
{
|
{
|
||||||
if (!isGuiThread())
|
if (!isGuiThread())
|
||||||
|
|||||||
@@ -145,6 +145,9 @@ signals:
|
|||||||
void stdOutBuffered(const QString &data, bool firstTime);
|
void stdOutBuffered(const QString &data, bool firstTime);
|
||||||
void stdErrBuffered(const QString &data, bool firstTime);
|
void stdErrBuffered(const QString &data, bool firstTime);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
bool terminate();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotTimeout();
|
void slotTimeout();
|
||||||
void finished(int exitCode, QProcess::ExitStatus e);
|
void finished(int exitCode, QProcess::ExitStatus e);
|
||||||
|
|||||||
@@ -213,6 +213,11 @@ void Command::execute()
|
|||||||
Core::ICore::progressManager()->addTask(task, taskName, binary + QLatin1String(".action"));
|
Core::ICore::progressManager()->addTask(task, taskName, binary + QLatin1String(".action"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Command::terminate()
|
||||||
|
{
|
||||||
|
emit doTerminate();
|
||||||
|
}
|
||||||
|
|
||||||
bool Command::lastExecutionSuccess() const
|
bool Command::lastExecutionSuccess() const
|
||||||
{
|
{
|
||||||
return d->m_lastExecSuccess;
|
return d->m_lastExecSuccess;
|
||||||
@@ -346,8 +351,8 @@ Utils::SynchronousProcessResponse Command::runVcs(const QStringList &arguments,
|
|||||||
if (d->m_flags & VcsBasePlugin::FullySynchronously) {
|
if (d->m_flags & VcsBasePlugin::FullySynchronously) {
|
||||||
response = runSynchronous(arguments, timeoutMS);
|
response = runSynchronous(arguments, timeoutMS);
|
||||||
} else {
|
} else {
|
||||||
// Run, connect stderr to the output window
|
|
||||||
Utils::SynchronousProcess process;
|
Utils::SynchronousProcess process;
|
||||||
|
connect(this, SIGNAL(doTerminate()), &process, SLOT(terminate()));
|
||||||
if (!d->m_workingDirectory.isEmpty())
|
if (!d->m_workingDirectory.isEmpty())
|
||||||
process.setWorkingDirectory(d->m_workingDirectory);
|
process.setWorkingDirectory(d->m_workingDirectory);
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ public:
|
|||||||
void addJob(const QStringList &arguments);
|
void addJob(const QStringList &arguments);
|
||||||
void addJob(const QStringList &arguments, int timeout);
|
void addJob(const QStringList &arguments, int timeout);
|
||||||
void execute();
|
void execute();
|
||||||
|
void terminate();
|
||||||
bool lastExecutionSuccess() const;
|
bool lastExecutionSuccess() const;
|
||||||
int lastExecutionExitCode() const;
|
int lastExecutionExitCode() const;
|
||||||
|
|
||||||
@@ -118,6 +119,7 @@ signals:
|
|||||||
void errorText(const QString &);
|
void errorText(const QString &);
|
||||||
void finished(bool ok, int exitCode, const QVariant &cookie);
|
void finished(bool ok, int exitCode, const QVariant &cookie);
|
||||||
void success(const QVariant &cookie);
|
void success(const QVariant &cookie);
|
||||||
|
void doTerminate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Internal::CommandPrivate *const d;
|
class Internal::CommandPrivate *const d;
|
||||||
|
|||||||
Reference in New Issue
Block a user