mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
Example build hardening (#1430)
* run_example.sh checks example existens the script exits if without example name parameter or if example directory doesn't exist * Update examples/run_example.sh Co-authored-by: Simon <simon@siku2.io> * Update examples/run_example.sh Co-authored-by: Simon <simon@siku2.io> Co-authored-by: Simon <simon@siku2.io>
This commit is contained in:
parent
7f6543a1b9
commit
fb27791332
@ -58,8 +58,20 @@ on_exit() {
|
||||
|
||||
trap on_exit EXIT
|
||||
|
||||
if [[ -z "$EXAMPLE" ]]; then
|
||||
fail "$0 requires the name of the example as the first argument"
|
||||
info "See the README.md file for help"
|
||||
exit
|
||||
fi
|
||||
|
||||
SRCDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" # this source dir
|
||||
|
||||
if [[ ! -d "$SRCDIR/$EXAMPLE" || "$EXAMPLE" = "common" || "$EXAMPLE" = "server" ]]; then
|
||||
fail "$EXAMPLE: no such example"
|
||||
info "See the README.md file for help"
|
||||
exit
|
||||
fi
|
||||
|
||||
cd "$SRCDIR/$EXAMPLE" # "$SRCDIR" ensures that this script can be run from anywhere.
|
||||
|
||||
# When using $CARGO_TARGET_DIR -> binary is located in different folder
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user