bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

reciproc pipe()


From: Robert Millan
Subject: reciproc pipe()
Date: Fri, 2 Sep 2005 12:25:21 +0200
User-agent: Mutt/1.5.10i

Hi!

Is there any way to tell bash to do something like this?  If there isn't, I
think it would be nice to have it (maybe through a builtin or something).

int p1[2];
int p2[2];

pipe(p1);
pipe(p2);

if (fork () == 0)
  {
    close (0); dup (p1[0]);
    close (1); dup (p2[1]);
    exec(whatever);
  }

if (fork () == 0)
  {
    close (0); dup (p2[0]);
    close (1); dup (p1[1]);
    exec(whatever);
  }

I.e, each process communicates with the other via stdin/stdout, and we get the
actual results via stderr.

-- 
Robert Millan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]