#!/bin/bash
# Copyright 2020-2022 Ian Jackson and contributors to Hippotat
# SPDX-License-Identifier: GPL-3.0-or-later WITH LicenseRef-Hippotat-OpenSSL-Exception
# There is NO WARRANTY.
set -e
set -o pipefail

actually_capture () {
    if [ "$BUILD_VERBOSE" ]; then
	tee "$log" | sed "s#^#$log #"
    else
	cat >"$log"
    fi
}

log="$1"; shift
mkdir -p tmp
"$@" 2>&1 | ts | actually_capture
