kiss: fix bug when log file cannot be written

This commit is contained in:
Dylan Araps 2021-07-11 00:35:50 +03:00
parent 5fab95f7c6
commit 69fc1e15ec
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C
1 changed files with 5 additions and 0 deletions

5
kiss
View File

@ -774,6 +774,11 @@ pkg_build() {
log "$1" "Starting build"
run_hook pre-build "$1" "$pkg_dir/$1"
# Attempt to create the log file early so any permissions errors are caught
# before the build starts. 'tee' is run in a pipe and POSIX shell has no
# pipe-fail causing confusing behavior when tee fails.
: > "$log_dir/$1-$time-$pid"
# Call the build script, log the output to the terminal and to a file.
# There's no PIPEFAIL in POSIX shell so we must resort to tricks like kill.
{ "$repo_dir/build" "$pkg_dir/$1" "$repo_ver" 2>&1 || {