Detect that a child is waiting for input

unDEFER via Digitalmars-d digitalmars-d at puremagic.com
Thu Nov 24 07:58:09 PST 2016


The program which stops even run without "&":

#!/usr/bin/rdmd
import std.stdio;
import std.file;
import std.string;

import core.sys.posix.unistd;
import core.stdc.errno;
import core.stdc.string;

void main()
{
     int res = core.sys.posix.unistd.tcsetpgrp(0, getppid());
     if (res != 0)
     {
         writefln("tcsetpgrp error: %s", 
fromStringz(strerror(errno)).idup());
         return;
     }

     foreach (line; stdin.byLine)
     {
         writefln(line);
     }
}


But really it is not decision.. The program stops not because 
where is no input, but because there is other process reading 
terminal..
It is not that I need..


More information about the Digitalmars-d mailing list