sh: Do not read from stdin if an error occurs during -i -c cmd.
Although using -i with -c does not seem very useful, it seems inappropriate to read commands from the terminal in this case. Side effect: if the -s -c extension is used and the -s option is turned off using 'set +s' during the interactive part, the shell now exits after an error or interrupt. Note that POSIX only specifies -s as option to sh, not to set. See also Austin Group issue #718.
This commit is contained in:
parent
eeeb863ff0
commit
fd7d6d8a29
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=253271
@ -170,8 +170,8 @@ main(int argc, char *argv[])
|
||||
if (minusc) {
|
||||
evalstring(minusc, sflag ? 0 : EV_EXIT);
|
||||
}
|
||||
state4:
|
||||
if (sflag || minusc == NULL) {
|
||||
state4: /* XXX ??? - why isn't this before the "if" statement */
|
||||
cmdloop(1);
|
||||
}
|
||||
exitshell(exitstatus);
|
||||
|
3
tools/regression/bin/sh/execution/int-cmd1.0
Normal file
3
tools/regression/bin/sh/execution/int-cmd1.0
Normal file
@ -0,0 +1,3 @@
|
||||
# $FreeBSD$
|
||||
|
||||
! echo echo bad | $SH -ic 'fi' 2>/dev/null
|
Loading…
Reference in New Issue
Block a user