Handling exit status in KJob

Milian Wolff mail at milianw.de
Sun Dec 1 21:02:25 UTC 2013


On Sunday 01 December 2013 20:46:32 Maciej Poleski wrote:
> Dnia niedziela, 1 grudnia 2013 20:11:12 Milian Wolff pisze:
> > On Sunday 01 December 2013 19:13:22 Maciej Poleski wrote:
> > > Hi,
> > > 
> > > Some processes ends with exit code different than 0 and still we want to
> > > consider this status as exit success. How to make KJob consider some
> > > positive return code as success?
> > 
> > A KJob has no notion of an exit code. So what exactly do you have in mind?
> > You probably start some QProcess in a Job (which one?). Then, make sure to
> > set some error status on the job class when the process fails.
> > 
> > Bye
> 
> I use DVcsJob to run bzr diff (to prepare diff as required for
> IBasicVersionControl implementation). bzr diff (and also diff command in
> Unix) returns 1 if there is a difference. But returning non 0 is
> interpreted as failure somewhere in KDevelop thus I am unable to use this
> metod of prepering diff for IBasicVersionControl.

Note that this is common behavior, see also EXIT_FAILURE and EXIT_SUCCESS 
defines in cstdlib which are 1 and 0 respectively.

> The question is how to bypass this inconvenience?
> There is a hard way - I probaby could subclass VcsJob and implement expected
> behavior. But subclassing VcsJob for every method in interface (including
> kill ability) is quite laborious.

The only option I see for that is to change the KDevplatform API. Make 
slotProcessExited in DVcsJob protected virtual, similar to slotProcessError, 
and then handle it your way in bzr.

Bye
-- 
Milian Wolff
mail at milianw.de
http://milianw.de


More information about the KDevelop-devel mailing list