Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

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@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author