Detect that a child is waiting for input

wobbles via Digitalmars-d digitalmars-d at puremagic.com
Wed Nov 23 12:02:08 PST 2016


On Wednesday, 23 November 2016 at 15:54:30 UTC, unDEFER wrote:
> On Tuesday, 22 November 2016 at 22:30:06 UTC, wobbles wrote:
>> Easier said than done as there's no signal the child sends to 
>> say "OK, I'm waiting now".
>>
>> You can use expect to do this, if you know what the output of 
>> the child will be just before it's waiting for IO.
>>
>> This is the D lib I've written to do this:
>> https://github.com/grogancolin/dexpect
>>
>> It's not wonderful or anything, but it works :)
>
> Thank you, good decision. Maybe I will use the idea. But how to 
> detect that "cat" (without arguments) waits input, if it 
> nothing prints?

You dont :)

You could wait for some period of time - and if that's passed and 
the child hasn't printed anything you can assume it's waiting for 
input.


More information about the Digitalmars-d mailing list