From mboxrd@z Thu Jan 1 00:00:00 1970 From: wkt@tuhs.org (Warren Toomey) Date: Thu, 10 Jul 2014 14:52:23 +1000 Subject: [TUHS] Excise process from a pipe In-Reply-To: <201407100249.s6A2nMh3017869@coolidge.cs.dartmouth.edu> References: <201407100249.s6A2nMh3017869@coolidge.cs.dartmouth.edu> Message-ID: <20140710045223.GA19076@www.oztivo.net> On Wed, Jul 09, 2014 at 10:49:22PM -0400, Doug McIlroy wrote: > It's easy for a process to insert a new process into a > pipeline either upstream or downstream. Was there ever a > flavor of Unix in which a process could excise itself > from a pipeline without breaking the pipeline? If in the middle of a pipeline, all I can think of is: close fd 0 and fd 1 dup() read end of pipe 1 to be stdin (fd 0) dup() write end of pipe 2 to be stdout (fd 1) exec("/bin/cat") Cheers, Warren