From b332053a160357e6c30c22f9ca90af9129e4550b Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sat, 2 Apr 2016 22:52:11 +0300 Subject: Document about using closed end of two-way pipes. --- doc/gawktexi.in | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'doc/gawktexi.in') diff --git a/doc/gawktexi.in b/doc/gawktexi.in index cd240a43..4d2a76f3 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -26598,6 +26598,11 @@ As a side note, the assignment @samp{LC_ALL=C} in the @command{sort} command ensures traditional Unix (ASCII) sorting from @command{sort}. This is not strictly necessary here, but it's good to know how to do this. +Be careful when closing the @code{"from"} end of a two-way pipe; in this +case @command{gawk} waits for the child process to exit, which may cause +your program to hang. (Thus, this particular feature is of much less +use in practice than being able to close the @code{"to"} end.) + @cindex @command{gawk}, @code{PROCINFO} array in @cindex @code{PROCINFO} array, and communications via ptys You may also use pseudo-ttys (ptys) for -- cgit v1.2.3 From 6d22cdfde8a2136080efba406d980ecac537b07d Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sat, 2 Apr 2016 22:56:52 +0300 Subject: Further doc on closing one end of a two-way pipe. --- doc/gawktexi.in | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'doc/gawktexi.in') diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 4d2a76f3..e233a383 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -26603,6 +26603,12 @@ case @command{gawk} waits for the child process to exit, which may cause your program to hang. (Thus, this particular feature is of much less use in practice than being able to close the @code{"to"} end.) +@quotation CAUTION +It is a fatal error to write to the @code{"to"} end of a two-way +pipe which has been closed. It is also a fatal error to read +from the @code{"from"} end of a two-way pipe that has been closed. +@end quotation + @cindex @command{gawk}, @code{PROCINFO} array in @cindex @code{PROCINFO} array, and communications via ptys You may also use pseudo-ttys (ptys) for -- cgit v1.2.3