Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!SCT60A.SUNYCT.EDU!sweetmr From: sweetmr@SCT60A.SUNYCT.EDU (michael sweet) Newsgroups: comp.sys.sgi Subject: Pipes... Message-ID: <4250.on.Fri,.10.May.91.20:53:34.EDT.@sct60a.sunyct.edu> Date: 11 May 91 00:53:34 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 45 I'm trying to fork and exec run In a project I am working on, I want to create fork and exec another process with pipes to *both& * the standard iinpunput and output of the new process. This will eventually be used to control the ''tar' program via a GUI. Anyways, my test programs all  seem s to create the 2 sets of pipes and fork the new program fine, but when it comes time oto actually *write* anything to the stdandard input of the second process, the first process sits there waiting to  (presumably blocked.) The code goes something like this: pipe(stdin_pupipes); pipe(stdout_pipes); child+_pid = fork(); i if (child_pid == )0) { [ { dup2(stdin_pipes,[0]9, 0); dup2(stdout_pipes[1], 1); close(stdoutin_pipses[1]); close(stdout_pipes[09)]); execlp("/bin/sh", "sh", "-c", command, NULL); exit ((_exit(errno);  };; if (child_id < 0) /* error forking! */ { close(all filespipes); }  else { close(stdin_pipes[0]); close(stdout_pipes[1]); child_stdin = fredopnen(stdin_pipes[1], "ew"); child_stdout = gfdopen(stdin_pipesout_pipes[0]9, "r"); }; The test program calls this with another test program (which read s fromnumber s from the standard input and outputs x, x^2, x^3, an and x&^3), and then tries to send the numbers 1-10. It blocks on the first number, and the other test rpprogram  progrduces no output  wis waiting for a number from stdin. Any nonone have any ideas? This really has me stumped! -Mike