fix: add windowsHide to all child_process.exec calls#65
fix: add windowsHide to all child_process.exec calls#65Spaztazim wants to merge 1 commit intohomebridge:beta-1.3.6from
Conversation
On Windows, child_process.exec() spawns visible cmd.exe console
windows by default. This causes visible flashing windows every time
ciao performs network discovery (ARP scans, interface detection).
Adding { windowsHide: true } to all 6 exec() calls suppresses the
console window creation while preserving identical functionality.
Affects: Windows only (no behavioral change on macOS/Linux).
Fixes homebridge#64
|
Started the review of this, but am away from my main setup for a few weeks. So will need to sit till then unless another collaborator takes it on. |
There was a problem hiding this comment.
Pull request overview
Suppresses visible console windows spawned by child_process.exec() on Windows during periodic network discovery in NetworkManager, addressing issue #64.
Changes:
- Adds
{ windowsHide: true }options object to allchildProcess.exec()calls used for ARP/neighbor discovery and Wi‑Fi state detection. - Keeps command behavior the same across platforms (option is a no-op on non-Windows).
| // we use "ip neigh" here instead of the aliases like "ip neighbour" or "ip neighbor" | ||
| // as those were only added like 5 years ago https://github.com/shemminger/iproute2/commit/ede723964a065992bf9d0dbe3f780e65ca917872 | ||
| childProcess.exec("ip neigh show", (error, stdout) => { | ||
| childProcess.exec("ip neigh show", { windowsHide: true }, (error, stdout) => { |
There was a problem hiding this comment.
Adding the { windowsHide: true } options parameter changes the childProcess.exec call signature from (command, callback) to (command, options, callback). The Jest spy in src/NetworkManager.spec.ts currently mocks exec with a 2-argument implementation (command, callback), which will cause callback to receive the options object and throw at runtime. Update the test mock(s) to accept the options arg (or use a rest-args signature) so CI doesn’t fail.
#250) * feat(diagnose): detect and inform about @homebridge/ciao cmd popup bug On Windows, OpenClaw's transitive dependency @homebridge/ciao (<=1.3.6) calls child_process.exec('arp -a ...') every 15-30 seconds without passing windowsHide:true, causing a cmd.exe popup to flash. This is an upstream library bug: - Issue: homebridge/ciao#64 - PR: homebridge/ciao#65 (open, not merged) ClawPanel deliberately chooses 'detect and inform' rather than silently patching the user's node_modules. We respect the user's control over their own machine. Changes: - src-tauri/src/commands/diagnose.rs: new check_ciao_windowshide_bug command; scans openclaw's @homebridge/ciao/lib/NetworkManager.js and reports whether the buggy exec pattern is present - src-tauri/src/lib.rs: register the new command - scripts/dev-api.js: Web-mode stub (returns affected:false since the bug does not manifest off-Windows) - src/lib/tauri-api.js: add api.checkCiaoWindowsHideBug - src/lib/ciao-bug-warning.js: new module with toast + modal flow, version-scoped dismiss (localStorage) - src/locales/modules/ciaoBug.js: translations in 5 primary languages - src/locales/index.js: register the ciaoBug module - src/main.js: call checker 3s after splash hides Non-Windows users see nothing; Windows users see a single warning toast (version-dismissible) linking to three fix paths: wait for upstream, apply patch-package, or edit NetworkManager.js manually. * fix(diagnose): gate helper with cfg(windows), drop unneeded return CI failures on Linux + macOS: - openclaw_module_root was dead code when target_os != windows since the only caller is the #[cfg(target_os = "windows")] block inside check_ciao_windowshide_bug - Explicit `return CiaoCheckResult {...};` in the non-Windows branch triggered clippy::needless_return Fix: - Add #[cfg(target_os = "windows")] to openclaw_module_root so it is not compiled on other platforms - Convert the non-Windows early exit to a tail expression
Summary
On Windows, \child_process.exec()\ spawns visible \cmd.exe\ console windows by default. This causes visible flashing windows every ~15-30 seconds when ciao performs network discovery (ARP scans, interface detection).
Changes
Adds { windowsHide: true }\ as the options parameter to all 6 \exec()\ calls in \NetworkManager.ts:
etworksetup -getairportnetwork\ (macOS Wi-Fi)
Impact
Testing
Tested on Windows 11 with Homebridge running as a background service. Before: cmd.exe windows flash every ~15 seconds. After: no visible windows.
Fixes #64