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

Re: BUG: failure in "vcs_info prompt" aborts precmd function



On Nov 23,  4:58pm, Daniel Hahler wrote:
} Subject: Re: BUG: failure in "vcs_info prompt" aborts precmd function
}
} On 22.11.2014 23:20, Mikael Magnusson wrote:
} 
} >> Apart from that, I am still wondering why the error in vcs_info causes abortion of the precmd function?!
} > 
} > Passing a non-existing file to $(< is a fatal error, or whichever term
} > is correct here.
} 
} I got that, but e.g. `false` does not abort the precmd function.

"false" is just a normal command that returns nonzero.

$(<notafile) is treated similarly to a syntax error, it kills the whole
surrounding context.

It's pretty easy to make it behave like a failed external command; can
anyone recall why it wasn't, other than to avoid allocating an empty
linked list?  It has been a fatal error since before revision control
was in use.  It is possible something really depends on being stopped
by this error?


diff --git a/Src/exec.c b/Src/exec.c
index 042215d..02a8fe3 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3840,8 +3840,8 @@ getoutput(char *cmd, int qt)
 	    return NULL;
 	untokenize(s);
 	if ((stream = open(unmeta(s), O_RDONLY | O_NOCTTY)) == -1) {
-	    zerr("%e: %s", errno, s);
-	    return NULL;
+	    zwarn("%e: %s", errno, s);
+	    return newlinklist();
 	}
 	return readoutput(stream, qt);
     }



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