UnixProcessParameters Struct

struct QProcess ::UnixProcessParameters

This struct was introduced in Qt 6.6.

详细描述

注意: This struct is only available on Unix platforms

This struct can be used to pass extra, Unix-specific configuration for the child process using QProcess::setUnixProcessParameters ().

Its members are:

  • UnixProcessParameters::flags Flags, see QProcess::UnixProcessFlags
  • UnixProcessParameters::lowestFileDescriptorToClose The lowest file descriptor to close.

When the QProcess::UnixProcessFlags::CloseFileDescriptors flag is set in the flags field, QProcess closes the application's open file descriptors before executing the child process. The descriptors 0, 1, and 2 (that is, stdin , stdout ,和 stderr ) are left alone, along with the ones numbered lower than the value of the lowestFileDescriptorToClose 字段。

All of the settings above can also be manually achieved by calling the respective POSIX function from a handler set with QProcess::setChildProcessModifier (). This structure allows QProcess to deal with any platform-specific differences, benefit from certain optimizations, and reduces code duplication. Moreover, if any of those functions fail, QProcess 将进入 QProcess::FailedToStart state, while the child process modifier callback is not allowed to fail.

另请参阅 QProcess::setUnixProcessParameters () 和 QProcess::setChildProcessModifier ().