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

List:       kde-devel
Subject:    Re: KProcess and stdout/stderr!
From:       aleXXX <alexander.neundorf () gmx ! net>
Date:       2001-10-29 21:02:39
[Download RAW message or body]

On Mon 29 Oct 01 22:37, Tim Lee wrote:
> Hi,
>
> I'm using KProcess to run a command that creates interleaved
> output from stdout and stderr, example follows:
>
> stdout: Cisco Systems VPN Client Version 3.0.8
> stdout: Copyright (C) 1998-2001 Cisco Systems, Inc. All Rights Reserved.
> stdout: Client Type(s): Linux
> stdout: Running on: Linux 2.4.9-6 #1 Thu Oct 18 09:39:55 EDT 2001 i686
> stdout:
> stdout: Initializing the IPSec link.
> stderr:
> stderr: initialization failed
> stdout: Disconnecting the IPSEC link.
> stdout: The VPN sub-system is busy or has failed.
>
> The lines are marked by the file descriptor they were written
> to.
>
> When I use KProcess and the established UNIX sockets I get the
> following when I display it as the command runs:
>
> stderr:
> stderr: initialization failed
> stdout: Cisco Systems VPN Client Version 3.0.8
> stdout: Copyright (C) 1998-2001 Cisco Systems, Inc. All Rights Reserved.
> stdout: Client Type(s): Linux
> stdout: Running on: Linux 2.4.9-6 #1 Thu Oct 18 09:39:55 EDT 2001 i686
> stdout:
> stdout: Initializing the IPSec link.
> stdout: Disconnecting the IPSEC link.
> stdout: The VPN sub-system is busy or has failed.
>
> I believe this is because the stdout is no longer attached to
> a tty and therefore is buffered.  I get none of the stdout

stdout is usually always buffered.
Did you actually also catch the stderr output ?
This is a different signal in KProcess (receivedStderr();).

> stuff until the command is finishing.  The command in question is
> a binary only so I can't alter it.
>
> Any ideas how to remove the buffering on stdout, assuming that
> is the problem?

setbuf(stdout,0); but this probably won't change anything for the binary you 
started.

Bye
Alex
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

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

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