Skip to content

Commit 54c7493

Browse files
cdervclaude
andcommitted
Fix deno detection script for paths with special characters
Follow-up to 333f9bd (Extract deno detection logic to separate script). - Use environment variable instead of inline string expansion in PowerShell commands to safely handle paths containing quotes, dollar signs, or backticks - Add explicit ENDLOCAL before EXIT /B statements for proper scope cleanup - Update configure.cmd error message to mention permissions and antivirus as possible causes (not just processes holding files) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 333f9bd commit 54c7493

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

configure.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if "%QUARTO_VENDOR_BINARIES%" == "true" (
2828
echo.
2929
echo ============================================================
3030
echo Error: Could not delete package/dist/ directory
31-
echo A process may be holding files open
31+
echo This may be due to permissions, antivirus, or another process holding files
3232
echo ============================================================
3333
echo.
3434
echo Try closing applications and run configure.cmd again

package/scripts/windows/check-deno-in-use.cmd

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ REM Validate that a path was provided
2323
IF "%TARGET_PATH%"=="" (
2424
echo Error: No directory path provided
2525
echo Usage: check-deno-in-use.cmd ^<directory-path^>
26+
ENDLOCAL
2627
EXIT /B 1
2728
)
2829

@@ -32,7 +33,9 @@ IF "!TARGET_PATH:~-1!"=="\" SET "TARGET_PATH=!TARGET_PATH:~0,-1!"
3233
REM Check if deno.exe is running from target path using PowerShell
3334
REM Uses .StartsWith() for exact prefix matching (not wildcard matching)
3435
REM Case-insensitive comparison appropriate for Windows file paths
35-
powershell -NoProfile -Command "if (Get-Process -Name deno -ErrorAction SilentlyContinue | Where-Object { $_.Path -and $_.Path.StartsWith('!TARGET_PATH!', [System.StringComparison]::CurrentCultureIgnoreCase) }) { exit 1 } else { exit 0 }" >NUL 2>&1
36+
REM Path passed via environment variable to safely handle special characters
37+
SET "DENO_CHECK_PATH=!TARGET_PATH!"
38+
powershell -NoProfile -Command "if (Get-Process -Name deno -ErrorAction SilentlyContinue | Where-Object { $_.Path -and $_.Path.StartsWith($env:DENO_CHECK_PATH, [System.StringComparison]::CurrentCultureIgnoreCase) }) { exit 1 } else { exit 0 }" >NUL 2>&1
3639

3740
IF "!ERRORLEVEL!"=="1" (
3841
REM Deno process found - show error message and process list
@@ -45,9 +48,11 @@ IF "!ERRORLEVEL!"=="1" (
4548
echo Directory: !TARGET_PATH!
4649
echo.
4750
echo Deno processes from this directory:
48-
powershell -NoProfile -Command "Get-Process -Name deno -ErrorAction SilentlyContinue | Where-Object { $_.Path -and $_.Path.StartsWith('!TARGET_PATH!', [System.StringComparison]::CurrentCultureIgnoreCase) } | Format-Table Id, Path -AutoSize"
51+
powershell -NoProfile -Command "Get-Process -Name deno -ErrorAction SilentlyContinue | Where-Object { $_.Path -and $_.Path.StartsWith($env:DENO_CHECK_PATH, [System.StringComparison]::CurrentCultureIgnoreCase) } | Format-Table Id, Path -AutoSize"
52+
ENDLOCAL
4953
EXIT /B 1
5054
)
5155

5256
REM No blocking deno process found
57+
ENDLOCAL
5358
EXIT /B 0

0 commit comments

Comments
 (0)