summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2023-05-12 19:50:51 -0700
committerThiago Macieira <thiago.macieira@intel.com>2023-07-08 15:03:23 -0700
commit13a1995e9dc987d1560b38d16b76442261b4aa8d (patch)
treebb2ba2d6ce159b1123721756c616cb10c8170c1a /src/corelib/io/qprocess.cpp
parent8f1df9aaa87f1d899babce42a8fdbb28c13ae604 (diff)
QProcess/Unix: add a few, basic session & terminal management flags
Doing setsid() and disconnecting from the controlling terminal are, in addition to resetting the standard file descriptors to /dev/null, a common task that daemons do. These options allow a QProcess to force a child to be a daemon. QProcess ensures that the operations are done in the correct order. Change-Id: I3e3bfef633af4130a03afffd175e9451d2716d7a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib/io/qprocess.cpp')
-rw-r--r--src/corelib/io/qprocess.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index ab7219a6cdb..78d2de77793 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -849,6 +849,22 @@ void QProcessPrivate::Channel::clear()
child. The \c stdin, \c stdout, and \c stderr file descriptors are
never closed.
+ \value [since 6.7] CreateNewSession Starts a new process session, by calling
+ \c{setsid(2)}. This allows the child process to outlive the session
+ the current process is in. This is one of the steps that
+ startDetached() takes to allow the process to detach, and is also one
+ of the steps to daemonize a process.
+
+ \value [since 6.7] DisconnectControllingTerminal Requests that the process
+ disconnect from its controlling terminal, if it has one. If it has
+ none, nothing happens. Processes still connected to a controlling
+ terminal may get a Hang Up (\c SIGHUP) signal if the terminal
+ closes, or one of the other terminal-control signals (\c SIGTSTP, \c
+ SIGTTIN, \c SIGTTOU). Note that on some operating systems, a process
+ may only disconnect from the controlling terminal if it is the
+ session leader, meaning the \c CreateNewSession flag may be
+ required. Like it, this is one of the steps to daemonize a process.
+
\value IgnoreSigPipe Always sets the \c SIGPIPE signal to ignored
(\c SIG_IGN), even if the \c ResetSignalHandlers flag was set. By
default, if the child attempts to write to its standard output or