Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: closing stdin (Re: _make suppress error on OpenBSD.)
- X-seq: zsh-workers 11297
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: closing stdin (Re: _make suppress error on OpenBSD.)
- Date: Wed, 10 May 2000 10:22:31 +0000
- In-reply-to: <200005100720.JAA05611@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <200005100720.JAA05611@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
On May 10, 9:20am, Sven Wischnowsky wrote:
} Subject: Re: closing stdin (Re: _make suppress error on OpenBSD.)
}
} Bart Schaefer wrote:
}
} > I've long forgotten (if I ever knew) why the stdin of ZLE functions is
} > closed.
}
} This was done (by me) in 6484. For messages leading up to this, see:
} 6462 etc.
Oh, goody, so it was even my idea. Sigh.
This should be documented somewhere (for both completion and widgets); I
just tried searching the docs for the string "close" starting at "Zsh Line
Editor" and except for a couple of times in "enclosed" it's not mentioned
until you hit Zftp. It probably would have saved Peter some grief when
trying to answer that recent vi question on zsh-users.
These may not be the best places to mention it, but they were the closest
that I could find.
Index: Doc/Zsh/compwid.yo
===================================================================
@@ -12,22 +12,27 @@
example(zle -C complete expand-or-complete completer)
-defines a widget named tt(complete). When this widget is bound to a key
-using the tt(bindkey) builtin command defined in the tt(zsh/zle) module
-(see
-ifzman(zmanref(zshzle))\
-ifnzman(noderef(Zsh Line Editor))\
-), typing that key will call the shell function tt(completer). This
-function is responsible for generating the possible matches using the
-builtins described below. Once the function returns, the completion code
-takes over control again and treats the matches as the builtin widget
-tt(expand-or-complete) would do. For this second argument, the name of any
-of the builtin widgets that handle completions can be given:
+defines a widget named `tt(complete)'. The second argument is the name
+of any of the builtin widgets that handle completions:
tt(complete-word), tt(expand-or-complete),
tt(expand-or-complete-prefix), tt(menu-complete),
tt(menu-expand-or-complete), tt(reverse-menu-complete),
tt(list-choices), or tt(delete-char-or-list). Note that this will still
work even if the widget in question has been rebound.
+
+When this newly defined widget is bound to a key
+using the tt(bindkey) builtin command defined in the tt(zsh/zle) module
+(\
+ifzman(see zmanref(zshzle))\
+ifnzman(noderef(Zsh Line Editor))\
+), typing that key will call the shell function `tt(completer)'. This
+function is responsible for generating the possible matches using the
+builtins described below. As with other ZLE widgets, the function is
+called with its standard input closed.
+
+Once the function returns, the completion code takes over control again
+and treats the matches in the same manner as the specified builtin
+widget, in this case tt(expand-or-complete).
startmenu()
menu(Special Parameters)
Index: Doc/Zsh/zle.yo
===================================================================
@@ -104,8 +104,10 @@
User-defined widgets, being implemented as shell functions,
can execute any normal shell command. They can also run other widgets
(whether built-in or user-defined) using the tt(zle) builtin command.
-They can use tt(read -k) or tt(read -q) to read characters from standard
-input. Finally, they can examine and edit the ZLE buffer being edited by
+The standard input of the function is closed to prevent external commands
+from unintentionally blocking ZLE by reading from the terminal, but
+tt(read -k) or tt(read -q) can be used to read characters. Finally,
+they can examine and edit the ZLE buffer being edited by
reading and setting the special parameters described below.
cindex(parameters, editor)
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author