Skip to content

return-p.tst: default exit status in trap in function #163

Description

@magicant

yash/tests/return-p.tst

Lines 158 to 169 in b302c8d

# TODO Yash does not yet support this
test_oE -e 0 -f 'default exit status in trap in function'
trap '(exit 1); return; echo X $?' INT
f() {
(kill -INT $$; exit 2)
echo Y $?
}
f
echo Z $?
__IN__
Z 2
__OUT__


Fixing this issue would be trickier than it looks. The return built-in needs to determine the exit status of the function it is in, and if it is in the handle_traps function, it would need to tell whether the function is being called from the trap handle or the trap handler is being called from the function. This is not straightforward since we don't have a stack trace or a way to determine the context of the call.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions