diff --git a/src/journal.sh b/src/journal.sh
index 516f292..0ad9913 100644
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -118,7 +131,6 @@ rlJournalStart(){
export __INTERNAL_PERSISTENT_DATA="$BEAKERLIB_DIR/PersistentData"
export __INTERNAL_TEST_RESULTS="$BEAKERLIB_DIR/TestResults"
export __INTERNAL_JOURNAL_OPEN=''
- __INTERNAL_PersistentDataLoad
export __INTERNAL_PHASES_FAILED=0
export __INTERNAL_PHASES_PASSED=0
export __INTERNAL_PHASES_SKIPPED=0
@@ -130,16 +142,20 @@ rlJournalStart(){
__INTERNAL_PHASE_STARTTIME=()
__INTERNAL_PHASE_METRICS=()
export __INTERNAL_PHASE_OPEN=0
+ __INTERNAL_PersistentDataLoad
if [[ -z "$__INTERNAL_JOURNAL_OPEN" ]]; then
# Create Header for XML journal
__INTERNAL_CreateHeader
# Create log element for XML journal
- __INTERNAL_WriteToMetafile log
+ __INTERNAL_WriteToMetafile log || {
+ __INTERNAL_LogText "could not write to metafile" FATAL
+ exit 1
+ }
+ __INTERNAL_JOURNAL_OPEN=1
+ # Increase level of indent
+ __INTERNAL_METAFILE_INDENT_LEVEL=1
fi
- __INTERNAL_JOURNAL_OPEN=1
- # Increase level of indent
- __INTERNAL_METAFILE_INDENT_LEVEL=1
# display a warning message if run in POSIX mode
if [ $POSIXFIXED == "YES" ] ; then
@@ -938,20 +957,30 @@ __INTERNAL_PrintHeadLog() {
# should be called before and after that respectively.
__INTERNAL_PersistentDataSave() {
- cat > "$__INTERNAL_PERSISTENT_DATA" <<EOF
-__INTERNAL_STARTTIME=$__INTERNAL_STARTTIME
-__INTERNAL_TEST_STATE=$__INTERNAL_TEST_STATE
-__INTERNAL_PHASES_PASSED=$__INTERNAL_PHASES_PASSED
-__INTERNAL_PHASES_FAILED=$__INTERNAL_PHASES_FAILED
-__INTERNAL_PHASES_SKIPPED=$__INTERNAL_PHASES_SKIPPED
-__INTERNAL_JOURNAL_OPEN=$__INTERNAL_JOURNAL_OPEN
-__INTERNAL_PHASES_WORST_RESULT=$__INTERNAL_PHASES_WORST_RESULT
-EOF
-declare -p __INTERNAL_PHASE_FAILED >> $__INTERNAL_PERSISTENT_DATA
-declare -p __INTERNAL_PHASE_PASSED >> $__INTERNAL_PERSISTENT_DATA
-declare -p __INTERNAL_PHASE_STARTTIME >> $__INTERNAL_PERSISTENT_DATA
-declare -p __INTERNAL_PHASE_TXTLOG_START >> $__INTERNAL_PERSISTENT_DATA
-declare -p __INTERNAL_PHASE_METRICS >> $__INTERNAL_PERSISTENT_DATA
+ local var
+ (
+ for var in \
+ __INTERNAL_STARTTIME \
+ __INTERNAL_TEST_STATE \
+ __INTERNAL_PHASES_PASSED \
+ __INTERNAL_PHASES_FAILED \
+ __INTERNAL_PHASES_SKIPPED \
+ __INTERNAL_JOURNAL_OPEN \
+ __INTERNAL_PHASE_OPEN \
+ __INTERNAL_PHASES_WORST_RESULT \
+ __INTERNAL_METAFILE_INDENT_LEVEL \
+ __INTERNAL_PHASE_TYPE \
+ __INTERNAL_PHASE_NAME \
+ __INTERNAL_PHASE_FAILED \
+ __INTERNAL_PHASE_PASSED \
+ __INTERNAL_PHASE_STARTTIME \
+ __INTERNAL_PHASE_TXTLOG_START \
+ __INTERNAL_PHASE_METRICS \
+ ;
+ do
+ declare -p $var
+ done
+ ) | sed -r 's/declare/\0 -g/' > "$__INTERNAL_PERSISTENT_DATA"
}
__INTERNAL_PersistentDataLoad() {