summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-04-11 10:23:55 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-04-11 10:23:55 +0000
commit7b9cff2754dc7f9d0106b936d6d716148040f1e1 (patch)
treea9e107f4a6c9f689b8f37fcf23ca787734d6a7a9
parent030c8f6106fc4bf1886dacabddb3b02a02600090 (diff)
downloadzsh-7b9cff2754dc7f9d0106b936d6d716148040f1e1.tar.gz
zsh-7b9cff2754dc7f9d0106b936d6d716148040f1e1.zip
21131: exit with status 127 when script not found
-rw-r--r--ChangeLog6
-rw-r--r--Src/init.c8
-rw-r--r--Test/A01grammar.ztst4
3 files changed, 14 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 5fc193d56..3d24e69ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-04-11 Peter Stephenson <pws@csr.com>
+
+ * 21131: Src/init.c, Test/A01grammar.ztst: exit with status 127
+ when a script is not found, making the error message more
+ sensible.
+
2005-04-10 Clint Adams <clint@zsh.org>
* unposted: config.guess, config.sub: update to 2005-03-24 and
diff --git a/Src/init.c b/Src/init.c
index 965f47174..b9658af63 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -308,14 +308,14 @@ parseargs(char **argv)
}
if (*argv) {
if (unset(SHINSTDIN)) {
- argzero = *argv;
if (!cmd)
- SHIN = movefd(open(unmeta(argzero), O_RDONLY | O_NOCTTY));
+ SHIN = movefd(open(unmeta(*argv), O_RDONLY | O_NOCTTY));
if (SHIN == -1) {
- zerr("can't open input file: %s", argzero, 0);
- exit(1);
+ zerr("can't open input file: %s", *argv, 0);
+ exit(127);
}
opts[INTERACTIVE] &= 1;
+ argzero = *argv;
argv++;
}
while (*argv)
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 15df464e0..093ef5635 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -452,3 +452,7 @@
$ZTST_testdir/../Src/zsh -f -c "'"
1:Parse error on inline command causes non-zero exit status
?zsh: unmatched '
+
+ $ZTST_testdir/../Src/zsh -f NonExistentScript
+127q:Non-existent script causes exit status 127
+?$ZTST_testdir/../Src/zsh: can't open input file: NonExistentScript