On Sat, Apr 04, 2015 at 01:47:24PM -0400, Scott Kostyshak wrote:

> On Sat, Apr 4, 2015 at 1:29 PM, Enrico Forestieri <for...@lyx.org> wrote:
> > On Sat, Apr 04, 2015 at 07:15:37PM +0200, Enrico Forestieri wrote:
> >
> >> > @@ -610,7 +613,12 @@ int SystemcallPrivate::exitCode()
> >> >     if (!process_)
> >> >             return -1;
> >> >
> >> > -   return process_->exitCode();
> >> > +   // From Qt's documentation, in regards to QProcess::exitCode(),
> >> > +   // "This value is not valid unless exitStatus() returns NormalExit"
> >> > +   if (process_->exitStatus() == QProcess::NormalExit)
> >> > +           return process_->exitCode();
> >> > +   else
> >> > +           return -2;
> >> >  }
> >>
> >> Change this to "return -1;" to mean that something went wrong, whatever
> >> that is.
> >
> > However, I think that the following is better:
> >
> >> > +   if (process_->exitStatus() != QProcess::NormalExit)
> >> > +           return -1;
> >> > +   return process_->exitCode();
> 
> Thanks for taking a look, Enrico. I followed your suggestions and
> committed at 7032b037.

It just occurred to me that you can also incorporate the previous check.
I mean, the following

        if (!process_)
                return -1;
        if (process_->exitStatus() != QProcess::NormalExit)
                return -1;

is better expressed as

        if (!process_ || process_->exitStatus() != QProcess::NormalExit)
                return -1;

Sorry for not realizing it before.

-- 
Enrico

Reply via email to