Skip to content

Commit

Permalink
Add support for any number of child pids
Browse files Browse the repository at this point in the history
  • Loading branch information
cmcginty committed May 1, 2021
1 parent 3b050b0 commit e40565e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions snapraid-aio-script.sh
Expand Up @@ -470,11 +470,11 @@ function snapraid_cmd() {
# finish. Probably not the best way of 'fixing' this issue. Someone with more
# knowledge can provide better insight.
function close_output_and_wait(){
local pid
exec >& "$OUT" 2>& "$ERROR"
CHILD_PID=$(pgrep -P $$)
if [[ -n "$CHILD_PID" ]]; then
wait "$CHILD_PID"
fi
for pid in $(pgrep -P $$); do
wait "$pid"
done
}

# Redirects output to file and screen. Open a new tee process.
Expand Down

0 comments on commit e40565e

Please sign in to comment.