diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-07-25 02:40:14 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-25 02:40:14 +0300 |
| commit | 8afd52ae57f9237f4f46138ad224dfc621d7ba59 (patch) | |
| tree | 349bbbd86c57863539ebc4c2eacf34550e076fa2 /scripts/windows_smoke_conpty_path.ps1 | |
| parent | 5f1957c27bd23f73b339265d3acd32f4a21878a3 (diff) | |
fix: bundle modern ConPTY on Windows (#1828)
refs #1533
refs #1644
Diffstat (limited to 'scripts/windows_smoke_conpty_path.ps1')
| -rw-r--r-- | scripts/windows_smoke_conpty_path.ps1 | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/scripts/windows_smoke_conpty_path.ps1 b/scripts/windows_smoke_conpty_path.ps1 index ce54dd45..bec93b66 100644 --- a/scripts/windows_smoke_conpty_path.ps1 +++ b/scripts/windows_smoke_conpty_path.ps1 @@ -59,8 +59,11 @@ Invoke-Checked rustc @("--crate-type", "cdylib", "--edition", "2021", $fakeSourc $oldPath = $env:PATH $oldSession = $env:HERDR_SESSION +$oldSocket = $env:HERDR_SOCKET_PATH +$oldClientSocket = $env:HERDR_CLIENT_SOCKET_PATH $env:PATH = "$fakeDir;$oldPath" $env:HERDR_SESSION = $Session +Remove-Item Env:HERDR_SOCKET_PATH, Env:HERDR_CLIENT_SOCKET_PATH -ErrorAction SilentlyContinue $server = $null try { @@ -84,9 +87,16 @@ try { throw "server did not become ready" } - $created = & $exe workspace create --cwd $PWD.Path 2>&1 - if ($LASTEXITCODE -ne 0) { - throw "workspace create failed with exit code $LASTEXITCODE`: $($created -join "`n")" + $savedErrorActionPreference = $ErrorActionPreference + try { + $ErrorActionPreference = "Continue" + $created = & $exe workspace create --cwd $PWD.Path 2>&1 + $createdExitCode = $LASTEXITCODE + } finally { + $ErrorActionPreference = $savedErrorActionPreference + } + if ($createdExitCode -ne 0) { + throw "workspace create failed with exit code $createdExitCode`: $($created -join "`n")" } $paneId = (($created -join "`n") | ConvertFrom-Json).result.root_pane.pane_id if ([string]::IsNullOrWhiteSpace($paneId)) { @@ -126,9 +136,27 @@ try { Write-Host "server stop during cleanup failed: $($_.Exception.Message)" } Wait-Process -Id $server.Id -Timeout 10 -ErrorAction SilentlyContinue + $server.Refresh() + if (-not $server.HasExited) { + & taskkill.exe /PID $server.Id /T /F 2>&1 | Out-Null + } } $global:LASTEXITCODE = 0 $env:PATH = $oldPath - $env:HERDR_SESSION = $oldSession + if ($null -eq $oldSession) { + Remove-Item Env:HERDR_SESSION -ErrorAction SilentlyContinue + } else { + $env:HERDR_SESSION = $oldSession + } + if ($null -eq $oldSocket) { + Remove-Item Env:HERDR_SOCKET_PATH -ErrorAction SilentlyContinue + } else { + $env:HERDR_SOCKET_PATH = $oldSocket + } + if ($null -eq $oldClientSocket) { + Remove-Item Env:HERDR_CLIENT_SOCKET_PATH -ErrorAction SilentlyContinue + } else { + $env:HERDR_CLIENT_SOCKET_PATH = $oldClientSocket + } Remove-Item -Recurse -Force $fakeDir -ErrorAction SilentlyContinue } |
