Detect that a child is waiting for input

Shachar Shemesh via Digitalmars-d digitalmars-d at puremagic.com
Tue Nov 22 23:18:27 PST 2016


On 20/11/16 14:21, unDEFER wrote:
> Hello!
> I'm using pipeProcess() to create a process:
>
> pipes = pipeProcess(["bash", "-c", BASH_COMMAND], Redirect.stdin |
> Redirect.stdout | Redirect.stderr);
>
> Is it possible detect that the child is waiting for input on stdin?
> I can't find decision even for C. I think it is impossible if the child
> uses unblocking reading. But I want to detect blocking reading.

The shell does that for background processes. I think it takes away the 
TTY from its children, and this way, when they try to read from stdin, 
they get SIGSTOP from the system.

I'm not sure what the precise mechanism is.

There are flags passed to wait which will cause it to report when a 
child gets SIGSTOP.

Hope this helps,
Shachar


More information about the Digitalmars-d mailing list