Skip to content

Commit 14327a7

Browse files
authored
make venvShellHook compatible with sh (#2333)
## Summary Fix #2329 by using a more minimal posix set in the venvShellHook ## How was it tested? Verified using `sh ./venvShellHook.sh` locally
1 parent 750bfc1 commit 14327a7

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

plugins/python/venvShellHook.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ create_venv() {
1717

1818
# Check that Python version supports venv
1919
if ! python -c 'import venv' 1> /dev/null 2> /dev/null; then
20-
echo "\033[1;33mWARNING: Python version must be > 3.3 to create a virtual environment.\033[0m"
20+
echo "WARNING: Python version must be > 3.3 to create a virtual environment."
2121
touch "$STATE_FILE"
2222
exit 1
2323
fi
@@ -31,15 +31,19 @@ if [ -d "$VENV_DIR" ]; then
3131
exit 0
3232
fi
3333
if ! is_devbox_venv "$VENV_DIR"; then
34-
echo "\033[1;33mWARNING: Virtual environment at $VENV_DIR doesn't use Devbox Python.\033[0m"
35-
read -p "Do you want to overwrite it? (y/n) " -n 1 -r
34+
echo "WARNING: Virtual environment at $VENV_DIR doesn't use Devbox Python."
35+
echo "Do you want to overwrite it? (y/n)"
36+
read reply
3637
echo
37-
if [[ $REPLY =~ ^[Yy]$ ]]; then
38+
if [[ $reply =~ ^[Yy]$ ]]; then
3839
echo "Overwriting existing virtual environment..."
3940
create_venv
40-
else
41+
elif [[ $reply =~ ^[Nn]$ ]]; then
4142
echo "Using your existing virtual environment. We recommend changing \$VENV_DIR to a different location"
4243
touch "$STATE_FILE"
44+
exit 0
45+
else
46+
echo "Invalid input. Exiting..."
4347
exit 1
4448
fi
4549
fi

0 commit comments

Comments
 (0)