From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24557 invoked from network); 7 Jun 1999 08:17:34 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 7 Jun 1999 08:17:34 -0000 Received: (qmail 29214 invoked by alias); 7 Jun 1999 08:17:20 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6484 Received: (qmail 29206 invoked from network); 7 Jun 1999 08:17:18 -0000 Date: Mon, 7 Jun 1999 10:17:16 +0200 (MET DST) Message-Id: <199906070817.KAA05053@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk Subject: PATCH: closing stdin in zle Here is the patch to temporarily close stdin when doing completion. I've put it at the very beginning, so this also effect completion widgets and `compctl -K'. I've also added similar code around the execution of normal zle (shell function-) widgets. Peter, is movefd(), redup(), zclose() the right way to do it? (At least it works...) Bye Sven ist das richtig so? auch fuer zle-widgets! diff -u os/Zle/zle_main.c Src/Zle/zle_main.c --- os/Zle/zle_main.c Sat Jun 5 13:31:11 1999 +++ Src/Zle/zle_main.c Sat Jun 5 15:28:25 1999 @@ -640,7 +640,7 @@ zsfree(msg); feep(); } else { - int osc = sfcontext; + int osc = sfcontext, osi = movefd(0); startparamscope(); makezleparams(0); @@ -650,6 +650,8 @@ endparamscope(); lastcmd = 0; r = 1; + redup(osi, 0); + zclose(osi); } } if (r) { diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c --- os/Zle/zle_tricky.c Sat Jun 5 13:31:12 1999 +++ Src/Zle/zle_tricky.c Sat Jun 5 15:26:49 1999 @@ -4586,7 +4586,7 @@ struct cmlist ms; Cmlist m; char *p, *os = s; - int onm = nmatches; + int onm = nmatches, osi = movefd(0); /* Inside $... ? */ if (compfunc && (p = check_param(s, 0))) @@ -4676,6 +4676,9 @@ validlist = 1; amatches = pmatches; + redup(osi, 0); + zclose(osi); + return 0; } PERMALLOC { @@ -4685,6 +4688,9 @@ if (nmatches && !errflag) { validlist = 1; + redup(osi, 0); + zclose(osi); + return 0; } if (!m || !(m = m->next)) @@ -4693,6 +4699,8 @@ errflag = 0; compmatcher++; } + redup(osi, 0); + zclose(osi); return 1; } -- Sven Wischnowsky wischnow@informatik.hu-berlin.de