diff --git a/share/shpkg/shpkg.subr b/share/shpkg/shpkg.subr
index 59331d7..93d07cd 100644
--- a/share/shpkg/shpkg.subr
+++ b/share/shpkg/shpkg.subr
@@ -91,17 +91,9 @@ err () {
shpkg_log () {
SHPKG_NAME="$1"
shift
+ set -o pipefail
shpkg_start_logging "${SHPKG_NAME}"
- shpkg_redirect_err "$@" >> "${SHPKG_LOG}" &
- PID1=$!
- tail -n 1000000 -f "${SHPKG_LOG}" &
- PID2=$!
- set +e
- wait $PID1
- RET=$?
- kill $PID2
- wait $PID2
- return $RET
+ shpkg_redirect_err "$@" | tee -a "${SHPKG_LOG}"
}
shpkg_redirect_err () {