mirror of
https://github.com/kellymichels/zscripts-token-savers
synced 2026-10-07 07:18:18 +00:00
fix(deploy): decode the box's output as UTF-8 so progress bars render as bars, not "Γöü" (#94)
* fix(deploy): decode the box's output as UTF-8, so progress bars are bars and not "Γöü" Mirror of the same change in the private scripts repo: [Console]::OutputEncoding is switched to UTF-8 (no BOM) around the deploy loop and restored in a finally. PowerShell 5.1 decodes ssh's stdout with the OEM code page, where the UTF-8 bytes of a progress bar read as three characters each. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore(checksums): zdeploy.ps1 changed, so its entry in CHECKSUMS.txt follows Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
73dd27c4f1
commit
57edc629c1
@ -8,7 +8,7 @@ b407ef5b298cd6fe94af492e9254b4447e34333d22f8c29d3e9d4d2881651cf3 zbackup_ec2.cm
|
|||||||
64bc3148b09e422ffe4890339fade2354a31f2c7ba004f2728c29a0a39c32f08 zchecksums.cmd
|
64bc3148b09e422ffe4890339fade2354a31f2c7ba004f2728c29a0a39c32f08 zchecksums.cmd
|
||||||
3e1c573e446238cae494d22d25376f278333dc25fdbc0a5abbdaa9349722b438 zchecksums.ps1
|
3e1c573e446238cae494d22d25376f278333dc25fdbc0a5abbdaa9349722b438 zchecksums.ps1
|
||||||
049f8e79fc8c3d8d96ae8ccb1155d191e2dbf2753f4d4d73ceca00aa1ab0481b zdeploy.cmd
|
049f8e79fc8c3d8d96ae8ccb1155d191e2dbf2753f4d4d73ceca00aa1ab0481b zdeploy.cmd
|
||||||
a55be5b5e857463fa3e321ff2a73337f8281b56f6dfd0a7e36ed1f7ba242afbc zdeploy.ps1
|
e87c9fcd494fd2b8399b14c18a1dfa72805e5c52a38f132591b4d523b8806631 zdeploy.ps1
|
||||||
30918a9260cb6220d6e2140edcf319fc0fa1e75b7fe36d0efe68b0d10cdde241 zec2.cmd
|
30918a9260cb6220d6e2140edcf319fc0fa1e75b7fe36d0efe68b0d10cdde241 zec2.cmd
|
||||||
695ec87ea6518933ee64524d369f1d0d5128bf6e54db31f555a888bdddcb9326 zec2.ps1
|
695ec87ea6518933ee64524d369f1d0d5128bf6e54db31f555a888bdddcb9326 zec2.ps1
|
||||||
ce3209ed8eaab242286e76aeb11b1249239e2804e3de456a1609cc7caa780b43 zec2_rotatekeys.cmd
|
ce3209ed8eaab242286e76aeb11b1249239e2804e3de456a1609cc7caa780b43 zec2_rotatekeys.cmd
|
||||||
|
|||||||
43
zdeploy.ps1
43
zdeploy.ps1
@ -1304,22 +1304,35 @@ function Invoke-ZTokensPublish {
|
|||||||
|
|
||||||
# ── Dispatch ─────────────────────────────────────────────────────────────────
|
# ── Dispatch ─────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
foreach ($key in $Projects) {
|
# pip, uv and docker draw progress bars with box-drawing characters: "━" is
|
||||||
# 'ztokens' matches the tool it runs (ztokens.cmd / ztokens.ps1). The old
|
# the bytes E2 94 81. PowerShell 5.1 decodes a native command's stdout - ssh's,
|
||||||
# singular 'ztoken' still works so existing habits and any script that
|
# here - with [Console]::OutputEncoding, which on Windows is the OEM code page
|
||||||
# already calls it keep running.
|
# (437 on this machine), where those three bytes read "Γöü". Forty per bar.
|
||||||
if ($key -in @('ztokens', 'ztoken')) { Invoke-ZTokensPublish; continue }
|
# Decode the box's output as the UTF-8 it is for the duration of the deploy,
|
||||||
$proj = Get-ZProject -Key $key
|
# and put the console back in the finally so a deploy that throws does not
|
||||||
Invoke-DeployGitPull -Proj $proj # no-op unless deploy.gitPull is set
|
# leave the session changed.
|
||||||
switch ([string]$proj.kind) {
|
$prevConsoleEncoding = [Console]::OutputEncoding
|
||||||
"python" { Invoke-PythonDeploy -Key $key -Proj $proj -ChangeNote $Note }
|
[Console]::OutputEncoding = New-Object System.Text.UTF8Encoding($false)
|
||||||
"vite" { Invoke-ViteDeploy -Key $key -Proj $proj -ChangeNote $Note }
|
try {
|
||||||
"nextjs" { Invoke-NextDeploy -Key $key -Proj $proj -ChangeNote $Note }
|
foreach ($key in $Projects) {
|
||||||
"edge" { Invoke-EdgeDeploy -Key $key -Proj $proj }
|
# 'ztokens' matches the tool it runs (ztokens.cmd / ztokens.ps1). The old
|
||||||
"docker" { Invoke-DockerDeploy -Key $key -Proj $proj }
|
# singular 'ztoken' still works so existing habits and any script that
|
||||||
"static" { Invoke-StaticDeploy -Key $key -Proj $proj }
|
# already calls it keep running.
|
||||||
default { throw "No deploy handler for kind '$($proj.kind)' (project '$key'). Add an Invoke-<Kind>Deploy function in zdeploy.ps1." }
|
if ($key -in @('ztokens', 'ztoken')) { Invoke-ZTokensPublish; continue }
|
||||||
|
$proj = Get-ZProject -Key $key
|
||||||
|
Invoke-DeployGitPull -Proj $proj # no-op unless deploy.gitPull is set
|
||||||
|
switch ([string]$proj.kind) {
|
||||||
|
"python" { Invoke-PythonDeploy -Key $key -Proj $proj -ChangeNote $Note }
|
||||||
|
"vite" { Invoke-ViteDeploy -Key $key -Proj $proj -ChangeNote $Note }
|
||||||
|
"nextjs" { Invoke-NextDeploy -Key $key -Proj $proj -ChangeNote $Note }
|
||||||
|
"edge" { Invoke-EdgeDeploy -Key $key -Proj $proj }
|
||||||
|
"docker" { Invoke-DockerDeploy -Key $key -Proj $proj }
|
||||||
|
"static" { Invoke-StaticDeploy -Key $key -Proj $proj }
|
||||||
|
default { throw "No deploy handler for kind '$($proj.kind)' (project '$key'). Add an Invoke-<Kind>Deploy function in zdeploy.ps1." }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
[Console]::OutputEncoding = $prevConsoleEncoding
|
||||||
}
|
}
|
||||||
# The timestamp goes through Stop-ZTracking as the FinalNote so it lands after
|
# The timestamp goes through Stop-ZTracking as the FinalNote so it lands after
|
||||||
# the tracking footer and before the trailing blank lines - the last thing on
|
# the tracking footer and before the trailing blank lines - the last thing on
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user