Skip to content

Commit

Permalink
NEW: jsplugin api allow waiting process finished
Browse files Browse the repository at this point in the history
  • Loading branch information
altairwei committed Jul 29, 2023
1 parent 42527c0 commit 24f1ea6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/share/WizCommonUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ QString WizCommonUI::RunExe(const QString &exeFileName, const QStringList &param
return exitCode == 0 ? QString(output) : QString(error);
}

QObject* WizCommonUI::RunProc(const QString &exeFileName, const QStringList &params, bool logging)
QObject* WizCommonUI::RunProc(const QString &exeFileName, const QStringList &params,
bool wait, bool logging)
{
QProcess *process = new QProcess(this);

Expand All @@ -222,6 +223,13 @@ QObject* WizCommonUI::RunProc(const QString &exeFileName, const QStringList &par
}

process->start(exeFileName, params);

if (wait) {
process->waitForStarted();
while(process->state() != QProcess::NotRunning)
QApplication::processEvents();
}

return process;
}

Expand Down
3 changes: 2 additions & 1 deletion src/share/WizCommonUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class WizCommonUI : public QObject
Q_INVOKABLE QString GetValueFromIni(const QString &fileName, const QString &section, const QString &key);
Q_INVOKABLE void SetValueToIni(const QString &fileName, const QString &section, const QString &key, const QString &value);
Q_INVOKABLE QString RunExe(const QString &exeFileName, const QStringList &params);
Q_INVOKABLE QObject* RunProc(const QString &exeFileName, const QStringList &params, bool logging = false);
Q_INVOKABLE QObject* RunProc(const QString &exeFileName, const QStringList &params,
bool wait = false, bool logging = false);
Q_INVOKABLE QObject* CreateQObject(const QString &className);

private:
Expand Down

0 comments on commit 24f1ea6

Please sign in to comment.