summaryrefslogtreecommitdiff
path: root/Functions/TCP/tcp_open
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-06-23 13:38:09 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-06-23 13:38:09 +0000
commit0d7df628a47f4d944a266fe547d1db3c6b55b6f1 (patch)
treed6f64308dfdf429f6d62908f9ddb0ca81ae8ac0d /Functions/TCP/tcp_open
parent4f9c07dc05d25b8b4abf1d6e9886cebd9b5ed7bf (diff)
downloadzsh-0d7df628a47f4d944a266fe547d1db3c6b55b6f1.tar.gz
zsh-0d7df628a47f4d944a266fe547d1db3c6b55b6f1.zip
25237: TCP function system: make tcp_on_open return status significant
Diffstat (limited to 'Functions/TCP/tcp_open')
-rw-r--r--Functions/TCP/tcp_open31
1 files changed, 23 insertions, 8 deletions
diff --git a/Functions/TCP/tcp_open b/Functions/TCP/tcp_open
index cd1afed28..60bcb5e5d 100644
--- a/Functions/TCP/tcp_open
+++ b/Functions/TCP/tcp_open
@@ -180,6 +180,29 @@ for sess in $sessnames; do
tcp_by_name[$sess]=$fd
[[ -o zle && -z $nozle ]] && zle -F $fd tcp_fd_handler
+
+ # needed for new completion system, so I'm not too sanguine
+ # about requiring this here...
+ if zmodload -i zsh/parameter; then
+ if (( ${+functions[tcp_on_open]} )); then
+ if ! tcp_on_open $sess $fd; then
+ if [[ -z $quiet ]]; then
+ if (( ${#sessargs} )); then
+ print "Session $sess" \
+"(host $sessargs[1], port $sessargs[2] fd $fd): tcp_on_open FAILED."
+ else
+ print "Session $sess (fd $fd) tcp_on_open FAILED."
+ fi
+ tcp_close -- $sess
+ else
+ tcp_close -q -- $sess
+ fi
+ stat=1
+ continue
+ fi
+ fi
+ fi
+
if [[ -z $quiet ]]; then
if (( ${#sessargs} )); then
print "Session $sess" \
@@ -188,14 +211,6 @@ for sess in $sessnames; do
print "Session $sess (fd $fd) opened OK."
fi
fi
-
- # needed for new completion system, so I'm not too sanguine
- # about requiring this here...
- if zmodload -i zsh/parameter; then
- if (( ${+functions[tcp_on_open]} )); then
- tcp_on_open $sess $fd
- fi
- fi
done
if [[ -z $TCP_SESS ]]; then