Skip to content

Commit

Permalink
use a pipe instead of bash process substitution.
Browse files Browse the repository at this point in the history
When using process substitution, we will not get a shell when typing
ctrl-c. Using a pipe, we need different code for getting the exit code
correct. Therefore we store the task_error value in a file.
This reverts most of 2b8ac09
  • Loading branch information
Thomas Lange committed Sep 18, 2017
1 parent 4e65685 commit 3c1d018
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions bin/fai
Expand Up @@ -335,11 +335,17 @@ unset newhostname

fstart > >( tee -a $LOGDIR/fai.log ) 2>&1

task action > >( tee -a $LOGDIR/fai.log ) 2>&1

if [ $task_error -gt 0 -o $? -gt 0 ]; then
task action |& tee -a $LOGDIR/fai.log
if [ ${PIPESTATUS[0]} -gt 0 ]; then
final_exit_code=1
fi
if [ -f $LOGDIR/task_error ]; then
task_error=$(< $LOGDIR/task_error)
if [ $task_error -gt 0 ]; then
final_exit_code=1
fi
fi


[ -L "/var/run/fai/current_config" ] && rm -f "/var/run/fai/current_config"

Expand Down
1 change: 1 addition & 0 deletions lib/subroutines
Expand Up @@ -200,6 +200,7 @@ task_error() {
task_error_func=${FUNCNAME[*]}
task_local_error=$1
[ $1 -gt $task_error ] && task_error=$1
echo $1 > $LOGDIR/task_error
[ $task_error -gt $STOP_ON_ERROR ] && stop_fai_installation
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down

0 comments on commit 3c1d018

Please sign in to comment.