+ # Since stderr and stdout may go to the same file and the script
+ # may run in situations with different types of buffering, enforce
+ # line buffering for both FDs. This helps to prevent interleave between
+ # the outputs in the resulting file for half written lines, eg.
+ # ok 93 - Tes# PERROR - xxxx
+ # t some function
+ ORIG_LTTNG_TEST_LOG_DIR="${LTTNG_TEST_LOG_DIR:-}"
+ LTTNG_TEST_LOG_DIR=""
+ if test "${log_file_d}" = yes && [ ! -e "${log_file}.d" ]; then
+ mkdir -p "${log_file}.d"
+ LTTNG_TEST_LOG_DIR="$(realpath "${log_file}.d")"
+ export LTTNG_TEST_LOG_DIR
+ fi
+ if [ "${LTTNG_TESTS_TAP_AUTOTIME:-}" != 0 ]; then
+ stdbuf -eL -oL -- "$@"
+ else
+ "$@"
+ fi
+ ret=$?
+ if [ "${ret}" = "0" ] && test "${log_file_d}" = yes && [ -d "${LTTNG_TEST_LOG_DIR}" ]; then
+ rm -rf "${LTTNG_TEST_LOG_DIR:?}/"
+ fi
+ if [ -n "${ORIG_LTTNG_TEST_LOG_DIR}" ]; then
+ LTTNG_TEST_LOG_DIR="${ORIG_LTTNG_TEST_LOG_DIR}"
+ fi
+ echo $ret