[util-iso-log] prepare to use lib

This commit is contained in:
udeved 2016-02-15 16:31:38 +01:00
parent 5b5d278ebf
commit bd631d7cad

View file

@ -21,6 +21,19 @@ error_function() {
exit 2
}
# $1: function
run_log(){
local logfile=${iso_dir}/$(gen_iso_fn).log shellopts=$(shopt -p)
logpipe=$(mktemp -u "/tmp/logpipe.XXXXXXXX")
mkfifo "$logpipe"
tee "$logfile" < "$logpipe" &
local teepid=$!
$1 &> "$logpipe"
wait $teepid
rm "$logpipe"
eval "$shellopts"
}
run_safe() {
local restoretrap
set -e
@ -32,15 +45,3 @@ run_safe() {
set +E
set +e
}
# $1: function
run_log(){
local logfile=${work_dir}/${imgname}.log
logpipe=$(mktemp -u "/tmp/logpipe.XXXXXXXX")
mkfifo "$logpipe"
tee "$logfile" < "$logpipe" &
local teepid=$!
$1 &> "$logpipe"
wait $teepid
rm "$logpipe"
}