From 89afcb7925fd55eb639b9d0aeefbe93a25c9331d Mon Sep 17 00:00:00 2001 From: tosu Date: Mon, 3 Jun 2024 21:43:51 +0200 Subject: [PATCH] Handle error when venv cannot be created --- woxi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/woxi b/woxi index adc6028..63ea687 100755 --- a/woxi +++ b/woxi @@ -30,9 +30,9 @@ log () { create_env () { rm -rf "${prefix}"/env command -v python3 >/dev/null 2>&1 || { log err "failed to find python3."; exit 2; } - python3 -m venv "${prefix}/env" || virtualenv --python "$(command -v python3)" "${prefix}/env" - command . "${prefix}"/env/bin/activate || { log err "failed to activate venv."; exit 3; } - pip3 install -r "${prefix}"/requirements.txt || { log err "failed to install dependencies."; exit 4; } + python3 -m venv "${prefix}/env" || virtualenv --python "$(command -v python3)" "${prefix}/env" || { log err "failed to create venv."; exit 3; } + command . "${prefix}"/env/bin/activate || { log err "failed to activate venv."; exit 4; } + pip3 install -r "${prefix}"/requirements.txt || { log err "failed to install dependencies."; exit 5; } } # Activate venv -- dot builtin should be called with command builtin: https://unix.stackexchange.com/a/740901/520093