QProcess::UnixProcessParameters Struct

struct QProcess::UnixProcessParameters

该结构在 Qt 6.6 中引入。

详细说明

注意: 此结构体仅适用于 Unix 平台。

此结构体可用于使用QProcess::setUnixProcessParameters() 为子进程传递额外的 Unix 特定配置。

其成员如下

  • UnixProcessParameters::flags 标志,请参阅QProcess::UnixProcessFlags
  • UnixProcessParameters::lowestFileDescriptorToClose 要关闭的最低文件描述符。

如果在flags 字段中设置了 QProcess::UnixProcessFlags::CloseFileDescriptors 标志,则QProcess 会在执行子进程前关闭应用程序的打开文件描述符。文件描述符 0、1 和 2(即stdinstdoutstderr )以及编号小于lowestFileDescriptorToClose 字段值的描述符不会被关闭。

上述所有设置也都可以通过使用QProcess::setChildProcessModifier() 设置的处理程序手动调用相应的 POSIX 函数来实现。这种结构允许QProcess 处理任何特定平台的差异,从某些优化中获益,并减少代码重复。此外,如果其中任何一个函数失效,QProcess 将进入QProcess::FailedToStart 状态,而子进程修改器回调则不允许失效。

另请参见 QProcess::setUnixProcessParameters() 和QProcess::setChildProcessModifier()。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.