Menu

#19 bosh: Using set -e causes unexpected termination within the function

1.0
closed
nobody
None
2020-04-28
2020-04-19
No

Using Schily Tools 2020-04-18 on Debian 10.3.
(No problem with Schily Tools 2020-03-27.)

set -e

foo() {
  echo 1
  false
  echo 2 # not executed
}

if foo; then
  :
fi

echo end # not executed

Related

Tickets: #15

Discussion

  • Jörg Schilling

    Jörg Schilling - 2020-04-19

    I'll have a look at this.

    BTW: Do you have a larger test suite for these problem, or did you discover the problems ad hoc?

     
  • Koichi Nakashima

    I am developing a test tool called ShellSpec for shell script.

    BDD style unit testing framework for POSIX compliant shell script
    https://github.com/shellspec/shellspec

    It supports ALL POSIX compliant shell includes ksh88 and of course bosh.

    ShellSpec itself is also tested with ShellSpec. So if the shell breaks, the test also breaks.

     
  • Jörg Schilling

    Jörg Schilling - 2020-04-19

    Hi, I am not sure whether the main issue is to never quit from inside a function if the return code
    of the function is checked.

    Could you check the attached patch?

     
  • Koichi Nakashima

    Hi, Thank you for your quick work. This issue seems fixed with the patch. However Ticket [#15] is resurrected.

     

    Related

    Tickets: #15

  • Jörg Schilling

    Jörg Schilling - 2020-04-28
    • status: open --> closed
     
  • Jörg Schilling

    Jörg Schilling - 2020-04-28

    Closed as it is fixed in the next release

     

Log in to post a comment.

MongoDB Logo MongoDB