You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "Mingqwqqaq (via GitHub)" <gi...@apache.org> on 2026/10/15 13:19:52 UTC

[PR] fix(desktop): preserve Windows opencli launcher paths [maka]

Mingqwqqaq opened a new pull request, #6121:
URL: https://github.com/apache/maka/pull/6121

   ## Summary
   
   Fix Windows opencli launchers failing with Chinese paths on CP936 systems or literal `%NAME%` in installation paths.
   
   Generate UTF-8 batch files with quiet code-page selection, escaped percent signs and delayed expansion disabled. Preserve MCP/Chrome launcher modes, output and exit codes.
   
   ## Verification
   
   - This branch independently passes root build, lint, format, typecheck and Desktop/UI Knip.
   - Real Windows cmd regression covers CP936/65001, Chinese text, spaces, `%NAME%`, `!NAME!`, `&`, both launcher modes and exit status.
   - Windows launcher suite: 3 passed, 2 POSIX-only cases skipped.
   - Matching implementation on Ubuntu: 4 passed, 1 Windows-only case skipped.
   ## AI use
   
   - [ ] No generative tool made a substantive contribution
   - [x] Generative tooling made a substantive contribution
   
   Tool(s) and scope: OpenAI Codex assisted with investigation, implementation, regression tests, review and verification. The commit includes `Generated-by: Codex`.
   
   ## Checklist
   
   - [x] Tests cover the change and fail without it
   - [x] Lint, format, typecheck and the affected suites pass locally on their supported platforms
   
   Does this PR entail a change in behavior?
   
   - [x] Yes — described under Summary above
   - [ ] No


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): preserve Windows opencli launcher paths [maka]

Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on code in PR #6121:
URL: https://github.com/apache/maka/pull/6121#discussion_r4284992281


##########
apps/desktop/src/main/opencli-chrome.ts:
##########
@@ -64,7 +64,10 @@ export function writeOpencliLaunchers(
   const write = (name: string, args: string): string => {
     if (platform === 'win32') {
       const file = join(dir, `${name}.cmd`);
-      writeFileSync(file, `@echo off\r\nset ELECTRON_RUN_AS_NODE=1\r\n"${executable}" "${entry}" ${args}\r\n`);
+      // cmd reads batch files using its console code page, even when paths are
+      // quoted. Keep UTF-8 paths literal through both batch expansion phases.
+      const quotePath = (path: string) => `"${path.replaceAll('%', '%%')}"`;
+      writeFileSync(file, `@echo off\r\nsetlocal DisableDelayedExpansion\r\nchcp 65001 >nul\r\nset ELECTRON_RUN_AS_NODE=1\r\n${quotePath(executable)} ${quotePath(entry)} ${args}\r\n`);

Review Comment:
   P3: `setlocal` does not scope `chcp`, so the console's code page stays at 65001 after the launcher exits. That is harmless for Chrome and Maka's hidden consoles. It is not harmless when an MCP client starts this launcher from the user's own terminal. You could restore the previous code page after the child exits and keep `%ERRORLEVEL%`, or note that this is intended.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): preserve Windows opencli launcher paths [maka]

Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on PR #6121:
URL: https://github.com/apache/maka/pull/6121#issuecomment-6256909197

   Thanks for the contribution and for addressing the review feedback. Merging now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): preserve Windows opencli launcher paths [maka]

Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han merged PR #6121:
URL: https://github.com/apache/maka/pull/6121


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org