From 0d7df628a47f4d944a266fe547d1db3c6b55b6f1 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 23 Jun 2008 13:38:09 +0000 Subject: 25237: TCP function system: make tcp_on_open return status significant --- Functions/TCP/tcp_open | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'Functions/TCP') 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 -- cgit 1.4.1