From 52ed6af5277100ed5b9a4f4231b94013ce539a2c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 25 May 2023 15:56:08 -0700 Subject: 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 Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess_p.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/corelib/io/qprocess_p.h') 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) -- cgit v1.2.3