bazel: write docsite script to .bin (#58768)

* bazel: write script to .bin

you can't remove the script after it has started - even with a trap
since sg gets killed before the trap is executed.

* Update sg.config.yaml

* add comment for docsite run script
This commit is contained in:
William Bezuidenhout 2023-12-06 11:56:39 +02:00 committed by GitHub
parent 811bacdb2c
commit 19b574b171
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -463,7 +463,20 @@ commands:
docsite:
description: Docsite instance serving the docs
cmd: bazel run --script_path=docsite_run.sh --noshow_progress --noshow_loading_progress //doc:serve && ./docsite_run.sh
env:
RUN_SCRIPT_NAME: .bin/bazel_run_docsite.sh
cmd: |
# We tell bazel to write out a script to run docsite and run that script via sg otherwise
# when we get a SIGINT ... bazel gets killed but docsite doesn't get killed properly. So we use --script_path
# which tells bazel to write out a script to run docsite, and let sg run that script rather, which means
# any signal gets propagated and docsite gets properly terminated.
#
# We also specifically put this in .bin, since that directory is gitignored, otherwise the run script is left
# around and currently there is no clean way to remove it - even using a bash trap doesn't work, since the trap
# never gets executed due to sg running the script.
bazel run --script_path=${RUN_SCRIPT_NAME} --noshow_progress --noshow_loading_progress //doc:serve
./${RUN_SCRIPT_NAME}
syntax-highlighter:
ignoreStdout: true