Skip to content

fix: add windowsHide to all child_process.exec calls#65

Closed
Spaztazim wants to merge 1 commit intohomebridge:beta-1.3.6from
Spaztazim:fix/windows-hide-arp-console
Closed

fix: add windowsHide to all child_process.exec calls#65
Spaztazim wants to merge 1 commit intohomebridge:beta-1.3.6from
Spaztazim:fix/windows-hide-arp-console

Conversation

@Spaztazim
Copy link
Copy Markdown
Contributor

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:

  • \�rp -a | findstr\ (Windows ARP interface enumeration)
  • \�rp -a -n -l\ (Linux ARP)
  • \ip neigh show\ (Linux neighbor discovery)
  • \�rp -a -n\ (macOS/BSD ARP, 2 calls)

  • etworksetup -getairportnetwork\ (macOS Wi-Fi)

Impact

  • Windows: Suppresses visible console window creation during network discovery
  • macOS/Linux: No behavioral change (\windowsHide\ is a no-op on non-Windows platforms)
  • Functionality: Identical — only the window visibility is affected

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

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
@NorthernMan54
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 all childProcess.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).

Comment thread src/NetworkManager.ts
// 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) => {
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
1186258278 added a commit to qingchencloud/clawpanel that referenced this pull request Apr 24, 2026
#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
@bwp91 bwp91 deleted the branch homebridge:beta-1.3.6 April 26, 2026 17:45
@bwp91 bwp91 closed this Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants