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(即stdin 、stdout 和stderr )以及编号小于lowestFileDescriptorToClose 字段值的描述符将保持不变。
上述所有设置也可通过从使用QProcess::setChildProcessModifier()设置的处理程序中调用相应的POSIX函数来手动实现。这种结构使QProcess 能够处理任何平台特有的差异,利用某些优化,并减少代码重复。此外,如果这些函数中的任何一个失败,QProcess 将进入QProcess::FailedToStart 状态,而子进程修饰符回调不允许失败。
另请参阅 QProcess::setUnixProcessParameters() 和QProcess::setChildProcessModifier()。
© 2026 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.