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

List:       kde-devel
Subject:    Re: How to pipe with KShellProcess
From:       Waldo Bastian <bastian () kde ! org>
Date:       2001-02-26 0:06:25
[Download RAW message or body]

On Sunday 25 February 2001 13:13, Phlip wrote:
> KDE Krew:
>
> Here's my sorry-assed attempt to drive both STDIN and STDOUT thru a
> KShellProcess:

I think your problem is that you need to process the output because otherwise 
the child process blocks on the output and while it blocks on the output you 
will not be able to feed it more input.

So the approach to take is to use writeStdin to start sending a block of data 
to you child process. Then you wait for either a "wroteStdin()" signal or a 
"receivedStdout()" signal (and for the processExited() signal in case your 
child process terminates for unforeseen reasons)

When you get wroteStdin() you can send a next block (if you have that) when 
you get receivedStdout().

Note that you must start your process with NotifyOnExit for this to work.

Note also that "waiting" for a signal means that you have to call the Qt 
event-loop one way or the other. Either the main one, or a local one.

Hope this helps you.

Cheers,
Waldo
-- 
bastian@kde.org | SuSE Labs KDE Developer | bastian@suse.com
 
>> Visit http://master.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