Skip to content

Commit dbbbd38

Browse files
committed
Update error handling & messages in caf & cafrun
1 parent 6601bc8 commit dbbbd38

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/extensions/caf.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,11 @@ fi
327327
set +o errtrace
328328
set +o errexit
329329
if "${cafc}" "${compiler_args[@]}" ; then
330-
exit 0
330+
exit $?
331331
else
332+
return_code=$?
332333
echo "Error: comand:" >&2
333334
echo " \`${cafc} ${compiler_args[*]}\`" >&2
334335
echo "failed to compile." >&2
335-
exit 12
336+
exit "${return_code}"
336337
fi

src/extensions/cafrun.in

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,15 @@ elif [[ "${1}" == -np || "${1}" == -n ]]; then
262262
mpiexec_args+=("${@:4:$((${#} - 3))}")
263263
fi
264264

265-
"${CAFRUN}" "${mpiexec_args[@]//''/}"
265+
if "${CAFRUN}" "${mpiexec_args[@]//''/}" ; then
266+
exit $?
267+
else
268+
return_code=$?
269+
echo "Error: Command:" >&2
270+
echo " \`${CAFRUN}" "${mpiexec_args[*]//''/}\`" >&2
271+
echo "failed to run." >&2
272+
exit "${return_code}"
273+
fi
266274
else
267275
echo "You must pass \"-np\", \"<number_of_images>\", \"/path/to/coarray_Fortran_program\" as the first 3 arguments to ${cmd}."
268276
exit 1

0 commit comments

Comments
 (0)