diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-10-31 12:26:17 -0400 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-10-31 22:10:14 +0000 |
commit | 9e9a07415e69bb09ed3de9612ddaf75bf3a8f610 (patch) | |
tree | ceafd84c2d323ceb72d1a7fb613521456c35de3f /Base/root | |
parent | 5ebfa8d620c20e7ee3b89bfb08332030216ecda6 (diff) | |
download | serenity-9e9a07415e69bb09ed3de9612ddaf75bf3a8f610.zip |
CI: Ensure the manpage generation step shuts down the VM on failure
Currently, if the script fails, it simply runs "exit 1". This exits the
script, but keeps the VM running, so CI hangs until it times out.
Instead of exiting, write a failure status to an error log and shutdown.
CI can then read that error log and fail the run if needed.
Diffstat (limited to 'Base/root')
-rwxr-xr-x | Base/root/generate_manpages.sh | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/Base/root/generate_manpages.sh b/Base/root/generate_manpages.sh index 9c07033ffa..4c3eb69559 100755 --- a/Base/root/generate_manpages.sh +++ b/Base/root/generate_manpages.sh @@ -5,7 +5,20 @@ export ARGSPARSER_EMIT_MARKDOWN=1 # Qemu likes to start us in the middle of a line, so: echo -rm -rf generated_manpages || exit 1 +ERROR_FILE="generate_manpages_error.log" +rm -f "$ERROR_FILE" + +exit_for_error() +{ + if test $DO_SHUTDOWN_AFTER_GENERATE { + touch "$ERROR_FILE" # Ensure it exists, in case there wasn't any stderr output. + shutdown -n + } else { + exit 1 + } +} + +rm -rf generated_manpages 2> "$ERROR_FILE" || exit_for_error for i in ( \ (UserspaceEmulator 1) \ @@ -36,8 +49,8 @@ for i in ( \ filename="generated_manpages/man$i[1]/$i[0].md" mkdir -p "generated_manpages/man$i[1]" echo "Generating for $i[0] in $filename ..." - $i[0] --help > "$filename" || exit 1 - echo -e "\n<!-- Auto-generated through ArgsParser -->" >> "$filename" || exit 1 + $i[0] --help > "$filename" 2> "$ERROR_FILE" || exit_for_error + echo -e "\n<!-- Auto-generated through ArgsParser -->" >> "$filename" 2> "$ERROR_FILE" || exit_for_error } echo "Successful." |