diff --git a/codearchiver-bot b/codearchiver-bot index be4e7cf..d4fc2e6 100755 --- a/codearchiver-bot +++ b/codearchiver-bot @@ -28,7 +28,7 @@ function log { function log_loop { prefix="$1" # If the output does not end with a LF, add one. Then replace CRLF with LF and replace remaining CR with LF. - { lastchar="$(tee /dev/fd/3 | tail -c 1 | xxd -p)"; if [[ "${lastchar}" != '0a' ]]; then printf '\n'; fi } 3>&1 | + { lastchar="$(tee /dev/fd/42 | tail -c 1 | xxd -p)"; if [[ "${lastchar}" != '0a' ]]; then printf '\n'; fi } 42>&1 | sed -u 's,\r$,,; s,\r,\n,g' | while IFS= read -r line; do log "${prefix}${line}"; done } @@ -177,9 +177,9 @@ function taint_block { timeout --signal=INT "${timeout}" \ codearchiver --verbose --write-artefacts-fd-3 "${url}" \ + 3> >(tee "${artefactsname}" | log_loop "Artefact from codearchiver ${singlejobid}: ") \ > >(log_loop "codearchiver ${singlejobid} out: ") \ - 2> >(tee "${logname}" | grep -Fv -e ' INFO ' | log_loop "codearchiver ${singlejobid} err: ") \ - 3> >(tee "${artefactsname}" | log_loop "Artefact from codearchiver ${singlejobid}: ") + 2> >(tee "${logname}" | grep -Fv -e ' INFO ' | log_loop "codearchiver ${singlejobid} err: ") status="$?" log "codearchiver ${url} finished with status code ${status}" #TODO Integrate this into the pipe from codearchiver above to avoid rereading the entire log file