[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Xtroll goes Qt/ KDE
From:       Johannes Sixt <Johannes.Sixt () telecom ! at>
Date:       1998-03-05 21:28:16
[Download RAW message or body]

On Wed, 04 Mar 1998, Carsten Hess wrote:
>- i have enhanced kprocess with a new mode "Both" since i need the order
>  of stderr and stdout-strings. There is only one socket for stdout AND
>  stderr which give back a ŽlineŽ. A line is (char*) and information on
>  the type (stdout, stderr). In this way the output is orderd.
>  There should also be a function which is called after creating the
>  child-process to set some terminal-settings.
>  Are you interested in the enhanced class? (Nothing else changed)

To get ordered stdout and stderr, there's no need to modify kprocess nowadays,
just derive from it:

class GdbProcess : public KProcess
{
protected:
    virtual int commSetupDoneC();
};

int GdbProcess::commSetupDoneC()
{
    if (!KProcess::commSetupDoneC())
        return 0;

    close(STDERR_FILENO);
    return dup2(STDOUT_FILENO, STDERR_FILENO) != -1;
}

However, in this way you lose the information whether a "line" is from stdout
or from stderr.

-- Hannes

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic