QProcess: make UnixProcessFlag an enum class

See: https://lists.qt-project.org/pipermail/development/2023-May/043804.html

Not being an enum class looks more of an oversight, in most places usage
of the enumerators was already prefixed with QProcess::UnixProcessFlag.

Change-Id: Ie37d74e0039d3f65f90af560cb85bb11b77ae20c
Pick-to: 6.6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ahmad Samir 2023-07-07 19:54:39 +03:00
parent cdc608359a
commit 22c540a66d
2 changed files with 4 additions and 3 deletions

View File

@ -176,7 +176,7 @@ public:
void setChildProcessModifier(const std::function<void(void)> &modifier); void setChildProcessModifier(const std::function<void(void)> &modifier);
Q_NORETURN void failChildProcessModifier(const char *description, int error = 0) noexcept; Q_NORETURN void failChildProcessModifier(const char *description, int error = 0) noexcept;
enum UnixProcessFlag : quint32 { enum class UnixProcessFlag : quint32 {
ResetSignalHandlers = 0x0001, // like POSIX_SPAWN_SETSIGDEF ResetSignalHandlers = 0x0001, // like POSIX_SPAWN_SETSIGDEF
IgnoreSigPipe = 0x0002, IgnoreSigPipe = 0x0002,
// some room if we want to add IgnoreSigHup or so // some room if we want to add IgnoreSigHup or so

View File

@ -860,8 +860,9 @@ void QChildProcess::startProcess() const noexcept
applyProcessParameters(d->unixExtras->processParameters); applyProcessParameters(d->unixExtras->processParameters);
auto flags = d->unixExtras->processParameters.flags; auto flags = d->unixExtras->processParameters.flags;
sigpipeHandled = flags.testAnyFlags(QProcess::ResetSignalHandlers | QProcess::IgnoreSigPipe); using P = QProcess::UnixProcessFlag;
sigmaskHandled = flags.testFlag(QProcess::ResetSignalHandlers); sigpipeHandled = flags.testAnyFlags(P::ResetSignalHandlers | P::IgnoreSigPipe);
sigmaskHandled = flags.testFlag(P::ResetSignalHandlers);
} }
if (!sigpipeHandled) { if (!sigpipeHandled) {
// reset the signal that we ignored // reset the signal that we ignored