mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Stop the time keyword overriding errexit (#351)
This bug was first reported in <https://www.illumos.org/issues/7694>. The time keyword currently overrides the errexit shell option, allowing failing scripts to continue after an error: $ cat 1.sh #!/bin/sh time false # This should cause the script to exit echo FAILURE true $ ksh -o errexit 1.sh real 0m0.00s user 0m0.00s sys 0m0.00s FAILURE src/cmd/ksh93/sh/xec.c: - When the time keyword runs a command, pass the errexit state flag to the sh_exec call. This state flag is required for ksh to exit when a command fails while the errexit option is on. src/cmd/ksh93/tests/basic.sh: - Add a regression test based on the reproducer.
This commit is contained in:
parent
f508660ddf
commit
a0eeb14787
4 changed files with 21 additions and 2 deletions
|
|
@ -2404,7 +2404,7 @@ int sh_exec(register const Shnode_t *t, int flags)
|
|||
#endif
|
||||
job.waitall = 1;
|
||||
sh_onstate(SH_TIMING);
|
||||
sh_exec(t->par.partre,OPTIMIZE);
|
||||
sh_exec(t->par.partre,sh_isstate(SH_ERREXIT)|OPTIMIZE);
|
||||
if(!timer_on)
|
||||
sh_offstate(SH_TIMING);
|
||||
job.waitall = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue