Skip to main content

max / alloy

Stop the radio warn line naming a cause it does not know capture returns Err for a spawn failure, a nonzero exit and non-UTF-8 stdout, so an rfkill that ran and exited nonzero was reported as a missing tool. The line now says the read failed and leaves the cause to the error text it already carries.
Co-Authored-By
Claude Opus 5 (1M context) <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-08-23 20:51 UTC
Signed with PGP, not checked
Commit: 2664bdf53d304a94d004a75371434cfd081387ae
Parent: c8775de
1 file changed, +7 insertions, -5 deletions
@@ -601,7 +601,7 @@
601 601 /// [`Radio::Unknown`] is two different facts wearing one name. rfkill ran and
602 602 /// listed no Bluetooth line, which is an answer: the machine has no Bluetooth
603 603 /// radio rfkill knows about, and the header correctly says nothing about
604 - /// blocking. Or rfkill did not run, in which case the console knows nothing and
604 + /// blocking. Or the read failed, in which case the console knows nothing and
605 605 /// the header says nothing about blocking anyway, which is the same screen for
606 606 /// the opposite reason. The second case also drops hard-block detection, so an
607 607 /// adapter that is off because of a physical switch reads as an adapter that is
@@ -630,7 +630,7 @@
630 630 Ok(raw) => parse_rfkill(&raw),
631 631 Err(err) => {
632 632 log.record(
633 - format!("# could not read the radio: rfkill did not run ({err})"),
633 + format!("# could not read the radio from rfkill ({err})"),
634 634 Severity::Warn,
635 635 );
636 636 Radio::Unknown
@@ -1854,18 +1854,20 @@
1854 1854 );
1855 1855 }
1856 1856
1857 - /// A read that could not run is a fault, and it produces the same header as
1857 + /// A read that failed is a fault, and it produces the same header as
1858 1858 /// a machine with no Bluetooth rfkill line. The old second spawn existed to
1859 1859 /// cover that; nothing covers it if the failure stays quiet.
1860 1860 #[test]
1861 - fn a_radio_read_that_did_not_run_says_so() {
1861 + fn a_radio_read_that_failed_says_so() {
1862 1862 let mut log = CommandLog::new();
1863 1863 let radio = radio_from(Err(anyhow::anyhow!("No such file or directory")), &mut log);
1864 1864 assert_eq!(radio, Radio::Unknown);
1865 1865
1866 1866 let entry = log.entries().last().expect("the fault is recorded");
1867 1867 assert!(
1868 - entry.command.contains("rfkill did not run"),
1868 + entry
1869 + .command
1870 + .contains("could not read the radio from rfkill"),
1869 1871 "{}",
1870 1872 entry.command
1871 1873 );