summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qprocess_p.h')
-rw-r--r--src/corelib/io/qprocess_p.h54
1 files changed, 24 insertions, 30 deletions
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index 1331aef169..9510101e74 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -259,29 +259,12 @@ public:
bool _q_startupNotification();
void _q_processDied();
- QProcess::ProcessChannelMode processChannelMode = QProcess::SeparateChannels;
- QProcess::InputChannelMode inputChannelMode = QProcess::ManagedInputChannel;
- QProcess::ProcessError processError = QProcess::UnknownError;
- QProcess::ProcessState processState = QProcess::NotRunning;
- QString workingDirectory;
-#ifdef Q_OS_WIN
- Q_PROCESS_INFORMATION *pid = nullptr;
-#else
- qint64 pid = 0;
-#endif
-
- bool emittedReadyRead = false;
- bool emittedBytesWritten = false;
-
Channel stdinChannel;
Channel stdoutChannel;
Channel stderrChannel;
bool openChannels();
bool openChannelsForDetached();
bool openChannel(Channel &channel);
-#if defined(Q_OS_UNIX)
- void commitChannels();
-#endif
void closeChannel(Channel *channel);
void closeWriteChannel();
void closeChannels();
@@ -289,26 +272,38 @@ public:
QString program;
QStringList arguments;
+ QString workingDirectory;
+ QProcessEnvironment environment = QProcessEnvironment::InheritFromParent;
#if defined(Q_OS_WIN)
QString nativeArguments;
QProcess::CreateProcessArgumentModifier modifyCreateProcessArgs;
+ QWinEventNotifier *processFinishedNotifier = nullptr;
+ Q_PROCESS_INFORMATION *pid = nullptr;
#else
- std::function<void(void)> childProcessModifier;
-#endif
- QProcessEnvironment environment = QProcessEnvironment::InheritFromParent;
-
-#ifdef Q_OS_UNIX
- Q_PIPE childStartedPipe[2] = {INVALID_Q_PIPE, INVALID_Q_PIPE};
+ struct UnixExtras {
+ std::function<void(void)> childProcessModifier;
+ QProcess::UnixProcessParameters processParameters;
+ };
+ std::unique_ptr<UnixExtras> unixExtras;
QSocketNotifier *stateNotifier = nullptr;
+ Q_PIPE childStartedPipe[2] = {INVALID_Q_PIPE, INVALID_Q_PIPE};
+ pid_t pid = 0;
int forkfd = -1;
-#else
- QWinEventNotifier *processFinishedNotifier = nullptr;
#endif
+ int exitCode = 0;
+ quint8 processState = QProcess::NotRunning;
+ quint8 exitStatus = QProcess::NormalExit;
+ quint8 processError = QProcess::UnknownError;
+ quint8 processChannelMode = QProcess::SeparateChannels;
+ quint8 inputChannelMode = QProcess::ManagedInputChannel;
+ bool emittedReadyRead = false;
+ bool emittedBytesWritten = false;
+
void start(QIODevice::OpenMode mode);
void startProcess();
#if defined(Q_OS_UNIX)
- void execChild(const char *workingDirectory, char **argv, char **envp);
+ void commitChannels() const;
#endif
bool processStarted(QString *errorMessage = nullptr);
void processFinished();
@@ -327,10 +322,6 @@ public:
bool startDetached(qint64 *pPid);
- int exitCode = 0;
- QProcess::ExitStatus exitStatus = QProcess::NormalExit;
- bool crashed = false;
-
bool waitForStarted(const QDeadlineTimer &deadline);
bool waitForReadyRead(const QDeadlineTimer &deadline);
bool waitForBytesWritten(const QDeadlineTimer &deadline);
@@ -343,6 +334,9 @@ public:
void cleanup();
void setError(QProcess::ProcessError error, const QString &description = QString());
void setErrorAndEmit(QProcess::ProcessError error, const QString &description = QString());
+
+ const QProcessEnvironmentPrivate *environmentPrivate() const
+ { return environment.d.constData(); }
};
#endif // QT_CONFIG(process)