GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(cli): write a codepage-safe Windows t3.cmd shim by DeryFerd · Pull Request #13401 · pingdotgg/t3code

fix(cli): write a codepage-safe Windows t3.cmd shim #13401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DeryFerd wants to merge 6 commits into pingdotgg:main from DeryFerd:fix/cli-utf8-windows-shim

Uh oh!

There was an error while loading. Please reload this page.

Closed

fix(cli): write a codepage-safe Windows t3.cmd shim #13401

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit Hold shift + click to select a range
2f9fcb8
fix(cli): write a codepage-safe Windows t3.cmd shim
DeryFerd Sep 24, 2026
da171be
Merge remote-tracking branch 'origin/main' into fix/cli-utf8-windows-…
juliusmarminge Oct 19, 2026
808b551
test(cli): rebuild Windows launcher regression coverage
juliusmarminge Oct 19, 2026
ead7843
fix(cli): isolate Windows launcher codepage state
juliusmarminge Oct 19, 2026
71dbf5e
fix(cli): avoid codepage changes for ASCII Windows installs
juliusmarminge Oct 19, 2026
50f8757
fix(cli): detect non-ASCII Windows paths without case folding
juliusmarminge Oct 19, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
fix(cli): avoid codepage changes for ASCII Windows installs
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge
juliusmarminge committed Oct 19, 2026
commit 71dbf5eea76c6dc5467d34bf3996ae48cafd8abc

Some comments aren't visible on the classic Files Changed page.

There are no files selected for viewing

17 changes: 12 additions & 5 deletions 17 apps/server/src/cli/update.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ it.layer(NodeServices.layer)("t3 update launcher", (it) => {
assert.ok(contents.includes(`"${newExe}" %*`));
assert.match(contents, /set "T3EC=%ERRORLEVEL%"\r?\nif defined T3CP chcp %T3CP% >nul/);
assert.match(contents, /exit \/b %T3EC%/);
yield* repointLauncher({
launchedAs: newExe,
versionsDir: versions,
targetEntryPath: path.join(root, "runtime/versions/2.0.0/t3.exe"),
}).pipe(
Effect.provideService(HostProcess.Platform, "win32"),
Effect.provideService(HostProcess.Environment, { PATH: bin }),
);
assert.ok(!(yield* fs.readFileString(shim)).includes("chcp"));
return;
}

Expand All @@ -148,15 +157,15 @@ it.layer(NodeServices.layer)("t3 update launcher", (it) => {
path.join(bin, "run.cmd"),
[
"@echo off",
'for /f "tokens=2 delims=:" %%c in (\'chcp\') do set "TEST_CP=%%c"',
'for /f "tokens=2 delims=:." %%c in (\'chcp\') do set "TEST_CP=%%c"',
"chcp 437 >nul",
"for /f \"tokens=2 delims=:\" %%c in ('chcp') do echo BEFORE=%%c",
"for /f \"tokens=2 delims=:.\" %%c in ('chcp') do echo BEFORE=%%c",
'set "T3CP=caller-codepage"',
'set "T3EC=caller-status"',
'call t3.cmd fixture.cjs %1 "one two" three',
'set "TEST_EXIT=%ERRORLEVEL%"',
'if not "%T3CP%:%T3EC%"=="caller-codepage:caller-status" exit /b 99',
"for /f \"tokens=2 delims=:\" %%c in ('chcp') do echo AFTER=%%c",
"for /f \"tokens=2 delims=:.\" %%c in ('chcp') do echo AFTER=%%c",
"chcp %TEST_CP% >nul",
"exit /b %TEST_EXIT%",
"",
Expand All @@ -167,8 +176,6 @@ it.layer(NodeServices.layer)("t3 update launcher", (it) => {
const child = NodeChildProcess.spawn("cmd.exe", ["/d", "/c", "run.cmd", `${status}`], {
cwd: bin,
stdio: ["ignore", "pipe", "pipe"],
// A separate console keeps the legacy codepage out of the test runner's console.
detached: true,
timeout: 10_000,
});
const [exitCode, stdout, stderr] = await Promise.all([
Expand Down
15 changes: 10 additions & 5 deletions 15 apps/server/src/cli/update.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,21 @@ export const repointLauncher = Effect.fn("cli.update.repoint_launcher")(function
const current = yield* fs.readFileString(shimPath).pipe(Effect.option);
const quoted = Option.isSome(current) ? /^"([^"]+)"/m.exec(current.value)?.[1] : undefined;
if (quoted === undefined || !ownsTarget(quoted)) return Option.none<string>();
// cmd decodes each batch line using the console codepage, including the UTF-8 target.
const utf8 = [...input.targetEntryPath].some((character) => character.codePointAt(0)! > 0x7f);
// A Ctrl-C that ends the batch skips restoration, so only switch for a non-ASCII target.
const contents = [
"@echo off",
"setlocal EnableExtensions DisableDelayedExpansion",
'set "T3CP="',
'for /f "tokens=2 delims=:" %%c in (\'chcp\') do set "T3CP=%%c"',
"if defined T3CP chcp 65001 >nul",
...(utf8
? [
'set "T3CP="',
'for /f "tokens=2 delims=:." %%c in (\'chcp\') do set "T3CP=%%c"',
"if defined T3CP chcp 65001 >nul",
]
: []),
`"${input.targetEntryPath}" %*`,
'set "T3EC=%ERRORLEVEL%"',
"if defined T3CP chcp %T3CP% >nul",
...(utf8 ? ["if defined T3CP chcp %T3CP% >nul"] : []),
"exit /b %T3EC%",
"",
].join("\r\n");
Expand Down
24 changes: 14 additions & 10 deletions 24 scripts/install.ps1
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,21 @@ if ((Test-Path $marker) -and ((Get-Content $marker -Raw).Trim() -eq $version)) {
Step "Setting up the t3 command..."
New-Item -ItemType Directory -Force -Path $binDir | Out-Null
$shim = Join-Path $binDir "t3.cmd"
# cmd decodes each batch line using the console codepage, including the UTF-8 target.
$exe = Join-Path $targetDir 't3.exe'
$utf8 = $exe -match '[^\x00-\x7F]'
# A Ctrl-C that ends the batch skips restoration, so only switch for a non-ASCII target.
$shimContents = @(
'@echo off',
'setlocal EnableExtensions DisableDelayedExpansion',
'set "T3CP="',
'for /f "tokens=2 delims=:" %%c in (''chcp'') do set "T3CP=%%c"',
'if defined T3CP chcp 65001 >nul',
"`"$(Join-Path $targetDir 't3.exe')`" %*",
'set "T3EC=%ERRORLEVEL%"',
'if defined T3CP chcp %T3CP% >nul',
'exit /b %T3EC%',
'@echo off'
'setlocal EnableExtensions DisableDelayedExpansion'
if ($utf8) {
'set "T3CP="'
'for /f "tokens=2 delims=:." %%c in (''chcp'') do set "T3CP=%%c"'
'if defined T3CP chcp 65001 >nul'
}
"`"$exe`" %*"
'set "T3EC=%ERRORLEVEL%"'
if ($utf8) { 'if defined T3CP chcp %T3CP% >nul' }
'exit /b %T3EC%'
''
) -join "`r`n"
[System.IO.File]::WriteAllText($shim, $shimContents, (New-Object System.Text.UTF8Encoding $false))
Expand Down
8 changes: 3 additions & 5 deletions 8 scripts/install.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,15 @@ describe.skipIf(HostProcess.Platform.defaultValue() !== "win32")("installer wind
NodePath.join(bin, "run.cmd"),
[
"@echo off",
'for /f "tokens=2 delims=:" %%c in (\'chcp\') do set "TEST_CP=%%c"',
'for /f "tokens=2 delims=:." %%c in (\'chcp\') do set "TEST_CP=%%c"',
"chcp 437 >nul",
"for /f \"tokens=2 delims=:\" %%c in ('chcp') do echo BEFORE=%%c",
"for /f \"tokens=2 delims=:.\" %%c in ('chcp') do echo BEFORE=%%c",
'set "T3CP=caller-codepage"',
'set "T3EC=caller-status"',
'call t3.cmd %1 "one two" three',
'set "TEST_EXIT=%ERRORLEVEL%"',
'if not "%T3CP%:%T3EC%"=="caller-codepage:caller-status" exit /b 99',
"for /f \"tokens=2 delims=:\" %%c in ('chcp') do echo AFTER=%%c",
"for /f \"tokens=2 delims=:.\" %%c in ('chcp') do echo AFTER=%%c",
"chcp %TEST_CP% >nul",
"exit /b %TEST_EXIT%",
"",
Expand All @@ -218,8 +218,6 @@ describe.skipIf(HostProcess.Platform.defaultValue() !== "win32")("installer wind
const child = NodeChildProcess.spawn("cmd.exe", ["/d", "/c", "run.cmd", `${status}`], {
cwd: bin,
stdio: ["ignore", "pipe", "pipe"],
// A separate console keeps the legacy codepage out of the test runner's console.
detached: true,
timeout: 10_000,
});
const [exitCode, stdout, stderr] = await Promise.all([
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.