Skip to content

Commit

Permalink
do not use QProcess on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik authored and nyalldawson committed Jan 27, 2021
1 parent ed5341b commit ed45bc1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
5 changes: 5 additions & 0 deletions python/core/auto_generated/qgsrunprocess.sip.in
Expand Up @@ -11,6 +11,7 @@




class QgsRunProcess: QObject /NoDefaultCtors/
{
%Docstring
Expand Down Expand Up @@ -61,6 +62,9 @@ This class should be used whenever a blocking process run is required. Unlike im
which rely on QApplication.processEvents() or creation of a QEventLoop, this class is completely
thread safe and can be used on either the main thread or background threads without issue.

On some platforms (e.g. iOS) , the process execution is skipped
https://lists.qt-project.org/pipermail/development/2015-July/022205.html

.. versionadded:: 3.18
%End

Expand Down Expand Up @@ -125,6 +129,7 @@ After execution completes, the process' result code will be returned.
%Docstring
After a call to :py:func:`~QgsBlockingProcess.run`, returns the process' exit status.
%End
int exitStatus() const;

};

Expand Down
13 changes: 13 additions & 0 deletions src/core/qgsrunprocess.cpp
Expand Up @@ -257,6 +257,7 @@ QStringList QgsRunProcess::splitCommand( const QString & )
// QgsBlockingProcess
//

#if QT_CONFIG(process)
QgsBlockingProcess::QgsBlockingProcess( const QString &process, const QStringList &arguments )
: QObject()
, mProcess( process )
Expand Down Expand Up @@ -345,4 +346,16 @@ QProcess::ExitStatus QgsBlockingProcess::exitStatus() const
{
return mExitStatus;
};
#else
QgsBlockingProcess::QgsBlockingProcess( const QString &action, const QStringList & )
{
Q_UNUSED( action )
QgsDebugMsg( "Skipping command: " + action );
}


int QgsBlockingProcess::run( const QString & )
{
return 0;
}
#endif
13 changes: 12 additions & 1 deletion src/core/qgsrunprocess.h
Expand Up @@ -22,7 +22,10 @@
#define QGSRUNPROCESS_H

#include <QObject>
#if QT_CONFIG(process)
#include <QProcess>
#endif

#include <QThread>

#include "qgis_core.h"
Expand Down Expand Up @@ -95,6 +98,9 @@ class CORE_EXPORT QgsRunProcess: public QObject SIP_NODEFAULTCTORS
* which rely on QApplication::processEvents() or creation of a QEventLoop, this class is completely
* thread safe and can be used on either the main thread or background threads without issue.
*
* On some platforms (e.g. iOS) , the process execution is skipped
* https://lists.qt-project.org/pipermail/development/2015-July/022205.html
*
* \ingroup core
* \since QGIS 3.18
*/
Expand Down Expand Up @@ -175,7 +181,11 @@ class CORE_EXPORT QgsBlockingProcess : public QObject
/**
* After a call to run(), returns the process' exit status.
*/
#if QT_CONFIG(process)
QProcess::ExitStatus exitStatus() const;
#else
int exitStatus() const {return 0;}
#endif

private:

Expand All @@ -184,8 +194,9 @@ class CORE_EXPORT QgsBlockingProcess : public QObject
std::function< void( const QByteArray & ) > mStdoutHandler;
std::function< void( const QByteArray & ) > mStderrHandler;

#if QT_CONFIG(process)
QProcess::ExitStatus mExitStatus = QProcess::NormalExit;

#endif
};


Expand Down

0 comments on commit ed45bc1

Please sign in to comment.