fix: Windows/Linux cross-platform compatibility#7
Conversation
|
Warning Review limit reached
More reviews will be available in 10 minutes and 13 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (22)
📝 WalkthroughWalkthroughThis PR standardizes file I/O across the full stack to use explicit UTF-8 encoding, adds a cross-platform file/folder opening helper to replace platform-specific subprocess calls, and improves Windows compatibility by handling backslash path separators in TypeScript and supporting Windows Python venv and font paths. ChangesCross-platform file I/O and encoding
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@backend/cli.py`:
- Around line 56-57: The except Exception: pass is silently swallowing
reveal/open failures; replace it with an except Exception as e that emits a
minimal warning to stderr (e.g., sys.stderr.write or logging.warning) including
a short context like "Failed to reveal/open path:" and the exception message so
users get feedback when the desktop integration or opener fails; update the
block where the code currently uses "except Exception: pass" (the reveal/open
error handler) to log the error instead of suppressing it.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e399e53d-0d39-47bc-a1f0-c6fbc6f7c74c
📒 Files selected for processing (20)
backend/cli.pybackend/presets.pybackend/services/asset_store.pybackend/services/claude_suggest.pybackend/services/clip_generator.pybackend/services/clips_history.pybackend/services/content_generator.pybackend/services/corrections.pybackend/services/encoder.pybackend/services/integrations/youtube/client.pybackend/services/integrations/youtube/learnings.pybackend/services/thumbnail_ai.pybackend/services/thumbnail_generator.pybackend/services/thumbnail_html.pybackend/services/transcript_packer.pybackend/services/video_cut.pybackend/services/video_processor.pysrc/config/paths.tssrc/ui/client/lib.tssrc/ui/web-server.ts
- detectPython: use venv\Scripts\python.exe + `python` on Windows - add encoding="utf-8" to 40 text-mode open() calls (cp1252 crashes/corruption) - thumbnail fonts: add Windows Arial fallbacks - reveal-in-folder: cross-platform _reveal_in_os() helper (os.startfile on Windows) - UI basename: split on both / and \ separators
- cli.py webui menu: shell=True on Windows so npm.cmd runs - thumbnail_html: prefer playwright.cmd shim, shell=True on Windows for npx/.cmd - web-server browse-file: add Windows PowerShell OpenFileDialog branch
- setup.ps1 mirrors setup.sh: deps check, dirs, face model, venv, pip/npm install, tsc build, .env PYTHON_PATH wiring, MCP config - podcli.cmd: venv-python detection, PodStack-command notice, cli.py passthrough - README: Windows Quick Start section - cli.py: log reveal/open failures to stderr instead of swallowing them
249bae0 to
a8ab102
Compare
Summary
podcli ran cleanly on macOS but had several Windows-breaking issues (a couple also affect non-UTF-8 Linux locales). This makes it work on Windows and Linux without changing macOS behavior — every edit is either platform-conditional or purely additive.
Fixes
Python interpreter discovery on Windows —
src/config/paths.tsdetectPython()now branches onprocess.platform === "win32": looks forvenv\Scripts\python.exeand falls back topython(notpython3). This was the hard blocker — the MCP server and web UI spawn this interpreter for every backend task, so on Windows nothing could run.UTF-8 encoding — 40 text-mode
open()calls across 17 backend filesAdded
encoding="utf-8"to every text-modeopen()/json target. Windows defaults text mode to cp1252, which silently corrupts UTF-8 transcripts on read and raisesUnicodeEncodeErrorwhen writing JSON containing emoji/non-Latin text. Binary opens,wave.open,urlopen,os.fdopen, and theos.devnull→subprocess fd were deliberately left untouched.Thumbnail fonts —
backend/services/thumbnail_generator.pyAdded
C:/Windows/Fonts/arial*.ttfto the TTC face list and standalone fallbacks (mirrors the existing pattern incaption_renderer.py). Previously Windows fell back to PIL's bitmap default font.Reveal-in-folder —
backend/cli.pyAdded one
_reveal_in_os()helper (open/os.startfile/xdg-openper platform, best-effort) and routed all 4 former call sites through it. Previously these ranxdg-openon Windows, which doesn't exist.UI basename helpers —
src/ui/client/lib.ts,src/ui/web-server.tsSplit on
/[/\\]/so Windows backslash paths render the filename rather than the whole path.npm/npx/.cmdshim execution on Windows —backend/cli.py,backend/services/thumbnail_html.pyOn Windows
npm/npxare.cmdbatch files that Python'ssubprocesscan't run without a shell. Thewebuimenu'snpm run build/ui:prodnow passshell=Trueon Windows; the Playwright thumbnail fallback prefers theplaywright.cmdshim and runsnpx/.cmdcandidates withshell=Trueon Windows.shell=Trueis Windows-only (it would break the arg list on POSIX). Node detection itself (shutil.which("node")→ invoked by absolute path) was already correct.Native file dialog on Windows —
src/ui/web-server.ts/api/browse-filehad onlyosascript(mac) /zenity(Linux). Added a Windows branch using a PowerShellOpenFileDialog(base64-EncodedCommandto avoid quoting issues,-STAfor WinForms).Verification
vitest run: 47/47 passtsc --noEmit: cleanpython3 -m compileall backend: OKopen()except the intentionalos.devnull(subprocess fd, encoding irrelevant).Not included (follow-ups)
video_cut.py:77,video_processor.py:1793): writesfile '<abspath>'with backslashes on Windows. ffmpeg generally accepts these, so left as-is; normalizing to/would be a safe future hardening.setup.ps1/podcli.cmd: a native Windows installer/launcher is a larger, separate piece. The MCP server still runs vianode dist/index.js+ npm scripts.