Path: csiph.com!xmission!news.glorb.com!usenet.stanford.edu!not-for-mail From: Linda Walsh Newsgroups: gnu.bash.bug Subject: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes? Date: Fri, 16 Oct 2015 16:52:05 -0700 Lines: 94 Approved: bug-bash@gnu.org Message-ID: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1445039540 23336 208.118.235.17 (16 Oct 2015 23:52:20 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash Envelope-to: bug-bash@gnu.org User-Agent: Thunderbird X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 173.164.175.65 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11677 In another note about different implementations associated with the pattern "[read[array]] LVALUE [< $(]+ RVALUE [)]?"... I gave a rough syntax for how I initially thought process substitution might have been implemented before I got that it used named pipes (like /dev/fd/99, for example). repeated, here (minus blank lines) for ref: > int savein,saveout; > int pid; > dup2(0, savein); > dup2(1, saveout); > int inout[2]; > #define stdin inout[0] > #define stdout inout[1] > pipe(&inout,O_NONBLOCK); > dupto(stdin,0); > dupto(stdout,1); > setup_childsighandler(to close 0 when child exits); #semi-trivial to write... > if ($pid=fork()) { #parent > dupto(saveout,1); > shell("readarray -t uservar("xyz")"); #reads from pipe:inout[0] > #child handler closes 0 > dupto(savein,0); > } else if (pid==0) { #child > close(0); > shell("echo $'a\nb\nc'"); #output goes out on pipe:inout[1] > exit(0); > } > ##parent continues -- no tmpfiles or named fifo's needed. > --------------- As I mentioned, my initial take on implementation was using standard pipes instead of named pipes (not having read or perhaps having glossed over the 'named pipes' aspect). And, similarly, when using "read a b c" from "<<<(rvalue-expr)" or <