diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 41a7fffd8b..7f3cc7bd89 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1588,15 +1588,6 @@ std::function QProcess::childProcessModifier() const "async-signal-safe" is advised). Most of the Qt API is unsafe inside this callback, including qDebug(), and may lead to deadlocks. - \note On some systems (notably, Linux), QProcess will use \c{vfork()} - semantics to start the child process, so this function must obey even - stricter constraints. First, because it is still sharing memory with the - parent process, it must not write to any non-local variable and must obey - proper ordering semantics when reading from them, to avoid data races. - Second, even more library functions may misbehave; therefore, this function - should only make use of low-level system calls, such as \c{read()}, - \c{write()}, \c{setsid()}, \c{nice()}, and similar. - \sa childProcessModifier() */ void QProcess::setChildProcessModifier(const std::function &modifier) diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 741cabe6fe..a5e52fb793 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -471,6 +471,8 @@ void QProcessPrivate::startProcess() #if defined(Q_OS_LINUX) && !QT_CONFIG(forkfd_pidfd) ffdflags |= FFD_USE_FORK; #endif + if (unixExtras && unixExtras->childProcessModifier) + ffdflags |= FFD_USE_FORK; pid_t childPid; forkfd = ::vforkfd(ffdflags , &childPid, execChild2, &execChild1);