diff --git a/app/start.ps1 b/app/start.ps1 index 00e4ce379c..294f3608ac 100644 --- a/app/start.ps1 +++ b/app/start.ps1 @@ -1,3 +1,6 @@ +# set the parent of the script as the current location. +Set-Location $PSScriptRoot + Write-Host "" Write-Host "Loading azd .env file from current environment" Write-Host "" diff --git a/app/start.sh b/app/start.sh index d703654e69..68fbec173c 100755 --- a/app/start.sh +++ b/app/start.sh @@ -1,5 +1,9 @@ #!/bin/sh +# cd into the parent directory of the script, +# so that the script generates virtual environments always in the same path. +cd "${0%/*}" || exit 1 + cd ../ echo 'Creating python virtual environment ".venv"' python3 -m venv .venv @@ -9,9 +13,10 @@ echo "Restoring backend python packages" echo "" ./.venv/bin/python -m pip install -r app/backend/requirements.txt -if [ $? -ne 0 ]; then +out=$? +if [ $out -ne 0 ]; then echo "Failed to restore backend python packages" - exit $? + exit $out fi echo "" @@ -20,9 +25,10 @@ echo "" cd app/frontend npm install -if [ $? -ne 0 ]; then +out=$? +if [ $out -ne 0 ]; then echo "Failed to restore frontend npm packages" - exit $? + exit $out fi echo "" @@ -30,9 +36,10 @@ echo "Building frontend" echo "" npm run build -if [ $? -ne 0 ]; then +out=$? +if [ $out -ne 0 ]; then echo "Failed to build frontend" - exit $? + exit $out fi echo "" @@ -44,7 +51,8 @@ cd ../backend port=50505 host=localhost ../../.venv/bin/python -m quart --app main:app run --port "$port" --host "$host" --reload -if [ $? -ne 0 ]; then +out=$? +if [ $out -ne 0 ]; then echo "Failed to start backend" - exit $? + exit $out fi