1 #---------------------------------*- sh -*-------------------------------------
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / A nd | Copyright held by original author
7 #------------------------------------------------------------------------------
9 # This file is part of OpenFOAM.
11 # OpenFOAM is free software; you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License as published by the
13 # Free Software Foundation; either version 2 of the License, or (at your
14 # option) any later version.
16 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 # You should have received a copy of the GNU General Public License
22 # along with OpenFOAM; if not, write to the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 # RunFunctionsSupplemental
29 # Additionnal run functions, based on the original RunFunctions
32 # Martin Beaudoin, Hydro-Quebec. All rights reserved
34 #------------------------------------------------------------------------------
36 # Exception handler: dump the tail of the log file on error
37 verbose_report_on_runApplication_error()
39 if [ "$reportOnErrorOnlyOnce" ] ; then
40 echo "Error running $APP_RUN..."
41 if [ -f log.$APP_RUN ] ; then
46 # Do not report again when exiting
47 unset reportOnErrorOnlyOnce
50 # Variation of runApplication with exception handling
51 runApplicationAndReportOnError ()
53 trap 'verbose_report_on_runApplication_error' ERR
57 reportOnErrorOnlyOnce=1
59 if [ -f log.$APP_RUN ] ; then
60 echo "$APP_RUN already run on $PWD: remove log file to run"
62 echo "Running $APP_RUN on $PWD"
63 $APP_RUN $* > log.$APP_RUN 2>&1