In EAPI 4 all standard helpers started to 'die' by default and 'nonfatal' was provided in order to provide an ability to restore the previous behavior. However, the 'nonfatal' is worded that it does not apply to direct die or assert calls. Therefore, custom helpers in eclasses are unable to use 'nonfatal' not to die. Although they can be made nonfatal in a custom way, I'd rather see PMS providing an unified ability, preferably within the bounds of 'nonfatal'. One solution I see is providing an additional 'die' command which would respect nonfatal, possibly with additional restrictions on leaving the function.
Could we add an option (like "-n") to "die" and "assert" that would make them respect nonfatal? I.e., "nonfatal die" would die, but "nonfatal die -n" would not (but return unsuccessful status).
(In reply to comment #1) > Could we add an option (like "-n") to "die" and "assert" that would make > them respect nonfatal? die -n 'foo failed.' looks a bit weird, to be honest. But I guess it would work. I would personally go more for something like '--weak' if it's supposed to be solve via an option.
Looking at the larger picture, almost all helper functions accept short options only. The two exceptions to this are "doman -i18n" and "has_version --host-root". In both cases, long option processing is incompatible with GNU getopt (e.g., long options cannot be abbreviated). Therefore I'd much prefer a single letter option like -c (mnemonic: "conditional"), -n ("nonfatal"), or -r ("return").
Well, the patch I submitted for review has: [[ ${1} == -n || ${1} == --respect-nonfatal ]]
(In reply to Michał Górny from comment #4) > Well, the patch I submitted for review has: > > [[ ${1} == -n || ${1} == --respect-nonfatal ]] None of our functions accepts both short and long options. Unless we decide on a consistent option scheme throughout (preferably, getopt compatible), I'd rather not add yet another variant.
In EAPI 6: https://gitweb.gentoo.org/proj/pms.git/commit/?id=35e05d2690ae23cf061165ddfbf5a852dc3bfe35