diff --git a/build b/build index 928e2455a..50d4d9368 100755 --- a/build +++ b/build @@ -1475,7 +1475,7 @@ fi if test -n "$LOGFILE" -a -z "$RUN_SHELL" ; then echo "logging output to $LOGFILE..." - rm -f $LOGFILE + rm -f "$LOGFILE" "$LOGFILE.pid" touch $LOGFILE # set start time, to be substracted for build log timestamps STARTTIME=`perl -e 'print time()'` @@ -1485,7 +1485,7 @@ if test -n "$LOGFILE" -a -z "$RUN_SHELL" ; then : elif test -n "$RUNNING_IN_VM" -o -n "$NO_TIMESTAMPS" ; then # no additional timestamps in inner vm build system - exec 1> >(echo "LOGGING_TEE_PID=$BASHPID" > $LOGFILE.pid ; exec -a 'build logging' tee -a $LOGFILE) 2>&1 + exec 1> >(echo "$BASHPID" > $LOGFILE.pid ; exec -a 'build logging' tee -a $LOGFILE) 2>&1 elif test -n "$VM_ROOT" ; then # external run of virtualization build exec 1> >(exec -a 'build logging' perl -e 'open(F,">>",$ARGV[0])||die("$ARGV[0]: $!\n");$|=1;select(F);$|=1;while(){my $p=sprintf("[%5ds] ", time()-'$STARTTIME');print STDOUT $p.$_;s/^\r//s;s/\r\n/\n/gs;print F $p.$_}' $LOGFILE) 2>&1 diff --git a/build-vm b/build-vm index 565a417fe..d52c3016c 100644 --- a/build-vm +++ b/build-vm @@ -330,6 +330,7 @@ vm_shutdown_halt_helper() { } vm_shutdown_halt() { + test "$VM_TYPE" = lxc -o "$VM_TYPE" = docker -o "$VM_TYPE" = nspawn && exit $1 # shutdown from fresh shell to close out deleted inodes exec -a "build: halt" -- $BASH -c "$(declare -f vm_shutdown_halt_helper); vm_shutdown_halt_helper $1" echo "Warning: clean shut down of the VM didn't work" @@ -348,10 +349,10 @@ vm_shutdown() { swapoff "$VM_SWAP" 2>/dev/null echo -n "BUILDSTATUS$1" >"$VM_SWAP" fi - test "$VM_TYPE" = lxc -o "$VM_TYPE" = docker -o "$VM_TYPE" = nspawn && exit $1 # Wait for logging tee to finish - test -f "$LOGFILE.pid" && . "$LOGFILE.pid" + LOGGING_TEE_PID= + test -f "$LOGFILE.pid" -a ! -L "$LOGFILE.pid" && read LOGGING_TEE_PID < "$LOGFILE.pid" if test -n "$LOGGING_TEE_PID"; then while kill -0 "$LOGGING_TEE_PID" 2>/dev/null; do sleep 0.1