Skip to content

Commit 43c831b

Browse files
CLI: Set UTF8 encoding for output on Windows (#1424)
1 parent b1c0eeb commit 43c831b

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

bin/studio-cli.bat

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
@echo off
22
setlocal
33

4+
rem Save original code page
5+
for /f "tokens=2 delims=:" %%i in ('chcp') do set "ORIGINAL_CP=%%i"
6+
set ORIGINAL_CP=%ORIGINAL_CP: =%
7+
8+
rem Set code page to UTF-8
9+
chcp 65001 >nul
10+
411
set ELECTRON_RUN_AS_NODE=1
512
call "%~dp0..\..\Studio.exe" "%~dp0..\cli\main.js" %*
613

7-
endlocal
14+
rem Restore original code page
15+
chcp %ORIGINAL_CP% >nul
16+
17+
endlocal

src/modules/cli/lib/install-windows.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,11 @@ const installPath = async () => {
6868
};
6969

7070
/**
71-
* Our app is installed in a versioned directory, so the
72-
* full path changes with every update. This makes it unreliable to add the
73-
* executable directly to the system PATH — we'd also need to handle cleaning up
74-
* outdated entries manually.
71+
* Creates a proxy batch file in a stable location to handle CLI execution.
7572
*
76-
* To solve this, we generate a fixed entry point (a proxy script) in a
77-
* stable location within AppData, outside the versioned folder. This script
78-
* simply forwards execution to the current version’s actual CLI entry point.
79-
* On update, we just rewrite the proxy to point to the new version.
73+
* Since our app is installed in a versioned directory, the full path changes with each update.
74+
* Instead of adding the versioned executable directly to PATH, we create a fixed proxy script
75+
* in the AppData directory that forwards execution to the current version's CLI entry point.
8076
*/
8177
const installProxyBatFile = async () => {
8278
try {

0 commit comments

Comments
 (0)