[Interest] Return value from QProcess

Duane duane.hebert at group-upc.com
Wed Apr 6 17:15:33 CEST 2016


On 06/04/2016 11:09 AM, Robert Buchinger wrote:
> On Wednesday, April 6, 2016 10:47:39 AM CEST Duane wrote:
>> On 06/04/2016 10:39 AM, Konstantin Tokarev wrote:
>>>
>>>
>>> 06.04.2016, 17:36, "Duane" <duane.hebert at group-upc.com>:
>>>> Qt 5.3, on TinyCore Linux 5 and Fedora 23.
>>>>
>>>> I'm currently using a call to std::system to load a module with insmod.
>>>>     This works but I would like to do it with QProcess.
>>>
>>> Why?
>>>
>>
>>
>> I want to wait for finished with a timeout.
>>
>>>> This also works
>>>> but I can't seem to get the return value of the insmod call like I can
>>>> with std::system. Any suggestions?
>>>
>>> QProcess::exitCode()
>>>
>>
>>
>> This works in the sense that it returns 0 when there's no error but it
>> doesn't seem to return the return value from insmod.  For example,
>> insmod returns 4531 when the file is already loaded but
>> QProcess::exitCode is 17.  I can rmmod module I guess.
>>
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>
> http://doc.qt.io/qt-5/qprocess.html#waitForFinished should be what you are looking for.
>
> You also could connect the finished signal which is emitted as soon as the QProcess has finished (http://doc.qt.io/qt-5/qprocess.html#finished)
>
>


I'm using waitForFinished().  This is working well.  But I wanted to 
inspect the error so that I could determine if the failure was that the 
module was already loaded, in which case all is good, or there was a 
real failure.  My app should be the only one using this particular 
module so I can just call rmmod first.  Then any non-zero return would 
be an error.

Mostly I was looking for why the actual return value of insmod wasn't 
returned.




More information about the Interest mailing list