Handle spaces when creating venv.

This commit is contained in:
d8ahazard 2023-01-06 12:34:06 -06:00
parent fbdc89c9b1
commit d9b41a787c

View File

@ -28,13 +28,15 @@ function Start-Venv {
if (Test-Path -Path "$VENV_DIR\Scripts\$python") { if (Test-Path -Path "$VENV_DIR\Scripts\$python") {
Activate-Venv Activate-Venv
} else { } else {
$PYTHON_FULLNAME = & $PYTHON -c "import sys; print(sys.executable)" $global:LASTEXITCODE = 0
Write-Output "Creating venv in directory $VENV_DIR using python $PYTHON_FULLNAME" try {
Invoke-Expression "$PYTHON_FULLNAME -m venv $VENV_DIR > tmp/stdout.txt 2> tmp/stderr.txt" $PYTHON_FULLNAME = & $PYTHON -c "import sys; print(sys.executable)"
if ($LASTEXITCODE -eq 0) { Write-Output "Creating venv in directory $VENV_DIR using $PYTHON_FULLNAME"
Activate-Venv Invoke-Expression "& '$PYTHON_FULLNAME' -m venv $VENV_DIR"
} else { Activate-Venv
} Catch {
Write-Output "Unable to create venv in directory $VENV_DIR" Write-Output "Unable to create venv in directory $VENV_DIR"
Write-Output $_
} }
} }
} }