forked from mirrored-repos/manjaro-tools
[util-iso-log] prepare to use lib
This commit is contained in:
parent
5b5d278ebf
commit
bd631d7cad
1 changed files with 13 additions and 12 deletions
|
@ -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"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue