ENH: suppress Info output for some cases (issue #722, #893)

- add additional control via a Foam::infoDetailLevel flag, which is
  supported by a 'DetailLevel' macro.  Eg,

      DetailLevel << "some information" << nl

- When infoDetailLevel is zero, the stdout for all Foam::system() calls
  are also redirected to stderr to prevent child output from
  appearing on the parent.

- close stdin before exec in system call.
This commit is contained in:
Mark Olesen
2018-06-22 12:26:33 +02:00
parent 83c9d3b287
commit 6390c18381
20 changed files with 260 additions and 211 deletions

View File

@ -56,9 +56,6 @@ notTest()
# Extract 'numberOfSubdomains' from system/decomposeParDict
# (or alternative location).
#
# Note that '#include' and other directives are disabled - only entries that
# are in the dictionary are considered.
#
# On failure:
# return '1'
# exit status 1
@ -68,14 +65,14 @@ getNumberOfProcessors()
local dict="${1:-system/decomposeParDict}"
# Re-use positional parameters for automatic whitespace elimination
set -- $(foamDictionary -disableFunctionEntries -entry numberOfSubdomains -value "$dict" 2>/dev/null)
set -- $(foamDictionary -entry numberOfSubdomains -value "$dict" 2>/dev/null)
if [ "$#" -eq 1 ]
then
echo "$1"
else
echo "Error getting 'numberOfSubdomains' from '$dict'" 1>&2
echo 1 # serial as fallback
echo 1 # Fallback is 1 proc (serial)
return 1
fi
}
@ -84,9 +81,6 @@ getNumberOfProcessors()
#
# Extract 'application' from system/controlDict
#
# Note that '#include' and other directives are disabled - only entries that
# are in the dictionary are considered.
#
# On failure:
# return 'false' which is also a command (ie, shell builtin or /bin/false)
# exit status 1
@ -94,14 +88,14 @@ getNumberOfProcessors()
getApplication()
{
# Re-use positional parameters for automatic whitespace elimination
set -- $(foamDictionary -disableFunctionEntries -entry application -value system/controlDict 2>/dev/null)
set -- $(foamDictionary -entry application -value system/controlDict 2>/dev/null)
if [ "$#" -eq 1 ]
then
echo "$1"
else
echo "Error getting 'application' from system/controlDict" 1>&2
echo false
echo false # Fallback
return 1
fi
}