ENH: support true/false, yes/no values for FOAM_ABORT (#1896)

- consistent with FOAM_SIGFPE etc.

- centralize code as error::useAbort() static function to avoid
  scattering the logic throughout the code.

ENH: also accept "0" and "1" string values for Switch

- not the normal path for Switch input (eg, from a dictionary), but
  consistent with bool definitions and simplifies string parsing.

  This means that `FOAM_SIGFPE=1 application` will now also work.
This commit is contained in:
Mark Olesen
2020-10-23 16:55:21 +02:00
parent 9eb73a92e2
commit 410d38b9d9
8 changed files with 29 additions and 9 deletions

View File

@ -71,7 +71,7 @@ namespace Foam
//- Mimic exit handling of the error class
static void exitNow(const error& err)
{
if (hasEnv("FOAM_ABORT"))
if (error::useAbort())
{
Perr<< nl << err << nl
<< "\nFOAM aborting (FOAM_ABORT set)\n" << endl;