fix(web): gate unix-only signal + test helpers off the windows build

Windows clippy under -D warnings flagged two items as dead code: the
SIGNAL_RECEIVED atomic (read only by the cfg(unix) signal handler and
its watcher) and with_test_binary (called only from the cfg(unix) exit
tests, whose stand-ins are /bin/sh scripts). Both now carry the same
gate as their sole users, so they stay live-code on every platform.
The whole native test suite (9796 tests) is green on windows this
round; this clears the last clippy warning.
This commit is contained in:
Kayshen-X 2026-08-09 13:51:50 +08:00
parent 98d0c15e1c
commit 7a24f227aa
2 changed files with 7 additions and 2 deletions

View file

@ -270,7 +270,10 @@ impl SubprocessProvider {
/// Point a known-CLI provider at a stand-in binary so the exit /
/// stderr / stdout handling can be exercised without the real CLI.
#[cfg(test)]
/// Its only callers are the unix-gated exit tests (the stand-ins are
/// `/bin/sh` scripts), so it carries the same gate to stay live-code
/// on Windows.
#[cfg(all(test, unix))]
pub(crate) fn with_test_binary(mut self, binary: impl Into<String>) -> Self {
self.binary = binary.into();
self

View file

@ -324,7 +324,9 @@ pub(super) fn check_persistence_configured(
/// Raised by the signal handler. A `static` because that is all a handler may
/// safely touch: it runs on an arbitrary thread with almost nothing allowed,
/// so it sets one atomic and returns, and the watcher thread below does the
/// rest.
/// rest. Unix-only — the handler and its watcher are the only readers, and
/// Windows keeps the supervisor-driven shutdown it has always had.
#[cfg(unix)]
static SIGNAL_RECEIVED: AtomicBool = AtomicBool::new(false);
/// Route SIGTERM and SIGINT into the daemon's existing shutdown path.