fix: Unity process matching now survives non-ASCII project paths on Windows - #1815
Merged
hatayama merged 2 commits intoJul 17, 2026
Conversation
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughWindows PowerShell process discovery now Base64-encodes UTF-8 command lines, while Go decodes them before identifying Unity processes and extracting project paths. Tests cover encoded input, non-ASCII paths, invalid payloads, and script generation. ChangesWindows process transport
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Expose the PowerShell script that lists Unity processes as windowsUnityProcessListScript() so its content can be unit tested, mirroring the existing focus script builders. No behavior change.
Windows PowerShell 5.1 encodes redirected stdout with the OEM code page (CP932 on Japanese Windows), so the Unity process list script delivered non-ASCII project paths as corrupted bytes that never matched the UTF-8 target path. FindRunningUnityProcess then missed running editors, breaking launch -q / launch -r / AlreadyRunning detection and focus targeting for any non-ASCII project path, with launch -q silently reporting success while doing nothing. Encode each command line as Base64 over UTF-8 bytes inside the PowerShell script and decode it in the Go parser, keeping the stdout stream ASCII-only regardless of the console code page. This follows the existing -EncodedCommand precedent in the installer scripts.
hatayama
force-pushed
the
fix/windows-process-list-encoding
branch
from
July 17, 2026 11:57
e17df95 to
0ec9d67
Compare
hatayama
merged commit Jul 17, 2026
078433e
into
feature/windows-v3-verification-integration
5 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
On Windows, Unity process matching fails for any project whose path contains non-ASCII characters (e.g. Japanese).
listUnityProcessesWindowsruns a Windows PowerShell 5.1 script (Get-CimInstance Win32_Process) and reads its stdout as UTF-8, but PowerShell 5.1 encodes redirected stdout with the OEM code page (CP932 on Japanese Windows). Non-ASCII path segments arrive as CP932 bytes, never match the UTF-8 normalized target path, andFindRunningUnityProcessalways comes back empty.Measured on a Japanese Windows 11 machine: the path segment
検証用was delivered as the CP932 byte sequence0x8C9F 0x8FD8 0x9770instead of its UTF-8 encoding.Impact
For any non-ASCII project path, all Unity process matching is broken:
uloop launch -qreports "No Unity process is running for this project." withSuccess:true/ exit 0 while the editor keeps running (silent no-op)uloop launch -rcannot find the process to restartAlreadyRunningdetection fails, so a plainuloop launchspawns a duplicate editoruloop focus-windowcannot resolve its target PIDNon-ASCII project paths are common on Japanese/Korean/Chinese Windows, so this has real user impact.
Fix
Transport each command line as Base64 over UTF-8 bytes inside the PowerShell script and decode it in the Go parser. The stdout stream becomes ASCII-only, so the console code page can no longer corrupt it.
Why Base64 instead of
[Console]::OutputEncoding = UTF8[Console]::OutputEncodingis known to throwIOException: The handle is invalidwhen the process has no attached console (a realistic condition for a CLI that is itself spawned detached), so it is less robust.-EncodedCommandin the install/uninstall scripts).Lines whose command field is not valid Base64 are skipped, consistent with how other malformed lines are handled.
Cross-check of other PowerShell output readers
Audited every place that parses PowerShell stdout:
cli/common/unityprocess/focus_windows.go(focus_unity_process_with_restore.ps1): stdout is a numeric window handle only (ASCII-safe) — not affected. Its captured stderr could contain localized CP932 error text on failure, but that only feeds error messages (cosmetic), not matching logic..Output()call sites run git / osascript / self-exec JSON — not affected.Verification (Windows 11, Japanese locale, Unity 2022.3.62f3)
TDD, unit (Red -> Green):
test[1] 検証用), and skipping of non-Base64 lines (using the measured CP932 bytes). All 4 failed before the fix, all pass after.E2E (Red, pre-fix build): project at
...\検証用エンコーディング\projlaunch->Ready:true(PID 27128), thenlaunch -q->"No Unity process is running for this project.",Success:true, exit 0, process still aliveE2E (Green, fixed build):
launch -q->Quit:true,PreviousProcessId:27128,"Unity process stopped.", process actually terminatedlaunch->Ready:true(PID 29960), secondlaunch->AlreadyRunning:trueAlreadyRunning:trueandlaunch -q->PreviousProcessIdreturned, process stoppedgo test ./...across all four modules: only the pre-existing Windows-incompatible baseline failures (launch/usr/bin/truefixture, TCP-only fixture, git fixture);commonmodule fully greenOut of scope (recorded separately)
launch -qreturningSuccess:true/ exit 0 when no process is found is itself questionable (it is what made this bug silent), but that is an intentional-looking behavior and is left as a separate design question.