diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2023-05-25 15:56:08 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2023-06-21 11:12:42 -0700 |
commit | 52ed6af5277100ed5b9a4f4231b94013ce539a2c (patch) | |
tree | 9e678eaba15e2942361dc93c67478f899d94e148 /src/corelib/io/qprocess_p.h | |
parent | 94ec17436cbdab52ed85e15ea197b538541b14ca (diff) |
QProcess/Unix: merge some code from startProcess() and startDetached()
... into a new local class called QChildProcess. This groups all the
information that the child process will need between the fork()/vfork()
call and the eventual execve(). That currently includes:
- the argv array, including resolving the program name to a path
- the envp array, possibly a null
- the working directory file descriptor
- the disabled thread cancellation state
We also move the fork() and vfork() calls to inside of this class,
eliminating the the nested lambda was passed to vforkfd(). This
duplicates the trick of calling a lambda in the child side of vfork()
now for the non-file descriptor version too.
None of this should have a side effect for the application. You may be
able to tell apart only in system-call tracing tools like strace(1) or
truss(1).
Change-Id: Ib5ce7a497e034ebabb2cfffd176284edfdd71b32
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src/corelib/io/qprocess_p.h')
-rw-r--r-- | src/corelib/io/qprocess_p.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index 0123af0463..9510101e74 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -304,7 +304,6 @@ public: void startProcess(); #if defined(Q_OS_UNIX) void commitChannels() const; - Q_NORETURN void execChild(int workingDirectory, char **argv, char **envp) const noexcept; #endif bool processStarted(QString *errorMessage = nullptr); void processFinished(); @@ -335,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) |