Skip to content

Accept exit-zero commands with stderr and add debug stderr details - #126

Merged
pponce merged 4 commits into
masterfrom
fix/successful-command-stderr
Oct 13, 2026
Merged

pponce merged 4 commits into
masterfrom
fix/successful-command-stderr

Conversation

@pponce

@pponce pponce commented Oct 13, 2026

Copy link
Copy Markdown
Owner

ON/OFF commands can operate a device and update its state file successfully, yet Script2 reports a HomeKit error whenever stderr is nonempty. This can produce the scene/Siri failure and switch flicker reported in #125.

Treat ON/OFF and stateless trigger commands as successful when execution completes without an error, even with stderr. Nonzero exits, timeouts, termination, and output overflow still fail. The state-script fail_on_state_exit_code behavior from #29 remains unchanged, including its default use of usable stdout after an ordinary nonzero exit.

Log a warning for nonblank stderr at the normal log level. Homebridge debug logs show stderr for ON, OFF, trigger, and state commands, capped at 4,096 characters and escaped to prevent control characters from injecting log entries. Raw commands and stdout remain omitted. Document that debug stderr can include sensitive script output and should be redacted before sharing.

Validation: all 49 runtime tests pass, including 14 new regressions and real child processes that write stderr while creating/deleting a state file; installed file-watcher test passes; all JavaScript syntax, package-content checks, and publisher regressions pass. Full npm test/npm run check are blocked locally because the environment denies npm-registry downloads for the existing Ajv dependency; GitHub CI still needs to run those checks. UI and configuration schema are unchanged.

Related to #125; the reporter's stderr hypothesis still needs confirmation.

@pponce
pponce marked this pull request as ready for review October 13, 2026 16:11
@pponce
pponce merged commit 7f00789 into master Oct 13, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant