Another fix to calling child process

The previous fix did not work if testssl.sh was found via `$PATH`. This seems to work in all cases. If testssl.sh is found via `$PATH` or if the command line includes a path, then `which` returns a non-empty response; otherwise, `$0` does not include any path, but one needs to be provided, so `$RUN_DIR/$PROG_NAME` is used.
This commit is contained in:
David Cooper 2017-04-12 12:15:27 -04:00 committed by GitHub
parent f094013aeb
commit 513ba8ff2d
1 changed files with 11 additions and 2 deletions

View File

@ -11763,7 +11763,12 @@ run_mass_testing() {
draw_line "=" $((TERM_WIDTH / 2)); outln;
outln "$(create_cmd_line_string "$0" "${MASS_TESTING_CMDLINE[@]}")"
"$first" || fileout_separator # this is needed for appended output, see #687
CHILD_MASS_TESTING=true "$RUN_DIR/$PROG_NAME" "${MASS_TESTING_CMDLINE[@]}" # we call ourselves here. $do_mass_testing is the parent, $CHILD_MASS_TESTING... you figured
# we call ourselves here. $do_mass_testing is the parent, $CHILD_MASS_TESTING... you figured
if [[ -z "$(which "$0")" ]]; then
CHILD_MASS_TESTING=true "$RUN_DIR/$PROG_NAME" "${MASS_TESTING_CMDLINE[@]}"
else
CHILD_MASS_TESTING=true "$0" "${MASS_TESTING_CMDLINE[@]}"
fi
first=false
done < "${FNAME}"
return $?
@ -11802,7 +11807,11 @@ run_mass_testing_parallel() {
# if the JSON file doesn't already exist.
"$JSONHEADER" && echo -n "" > "$TEMPDIR/jsonfile_$(printf "%08d" $NR_PARALLEL_TESTS).json"
PARALLEL_TESTING_CMDLINE[NR_PARALLEL_TESTS]="$(create_cmd_line_string "$0" "${MASS_TESTING_CMDLINE[@]}")"
CHILD_MASS_TESTING=true "$RUN_DIR/$PROG_NAME" "${MASS_TESTING_CMDLINE[@]}" > "$TEMPDIR/term_output_$(printf "%08d" $NR_PARALLEL_TESTS).log" &
if [[ -z "$(which "$0")" ]]; then
CHILD_MASS_TESTING=true "$RUN_DIR/$PROG_NAME" "${MASS_TESTING_CMDLINE[@]}" > "$TEMPDIR/term_output_$(printf "%08d" $NR_PARALLEL_TESTS).log" &
else
CHILD_MASS_TESTING=true "$RUN_DIR/$PROG_NAME" "${MASS_TESTING_CMDLINE[@]}" > "$TEMPDIR/term_output_$(printf "%08d" $NR_PARALLEL_TESTS).log" &
fi
PARALLEL_TESTING_PID[NR_PARALLEL_TESTS]=$!
NR_PARALLEL_TESTS+=1
sleep $PARALLEL_SLEEP