Pārlūkot izejas kodu

bench: the script-pty wrapper is macOS-only — util-linux script (Linux nodes) has no positional command and parsed the harness flags as its own ('unrecognized option --base-url'); non-macOS goes to the direct-exec fallback

Alexander Korolev 3 nedēļas atpakaļ
vecāks
revīzija
bfbbf854b3
1 mainītis faili ar 16 papildinājumiem un 17 dzēšanām
  1. 16 17
      src/bench.rs

+ 16 - 17
src/bench.rs

@@ -112,19 +112,15 @@ fn pump<R: Read>(mut reader: R, to_console: bool, file: Arc<Mutex<fs::File>>) {
 /// The child runs under a pty (`script -q /dev/null`) instead of raw pipes:
 /// tool-eval-bench's rich Live display deadlocks on a non-tty stdout pipe
 /// right after the perf phase (deterministic on the 2x lane; 4x runs got
-/// lucky) while it runs clean on a tty, exactly as in an interactive
-/// terminal (2026-09-09). `script` is BSD/macOS form (the launcher is a
-/// Mac tool); if it is absent we fall back to the direct exec.
+/// lucky) while it runs clean on a tty (2026-09-09). The wrapper is
+/// macOS-only (BSD `script`); elsewhere we fall back to the direct exec.
 ///
 /// The pty makes the tool think it is interactive — rich redraws its
-/// spinner/progress bars in place (\r soup on one line) and that soup
-/// leaked into the saved .log, even shadowing real parser cells
-/// (glm53-flash-eugr-2x, 2026-09-12). `TTY_COMPATIBLE=0` is rich's own
-/// knob for this: the console renders non-interactively (progress bars
-/// stay silent during the run, one final frame at the end) while the pty
-/// keeps the deadlock workaround intact. `NO_COLOR=1` covers non-rich
-/// output. Verified locally under `script`: 1.3 KB/8 CR of soup → 141
-/// bytes/1 static final frame.
+/// spinner/progress bars in place (\r soup on one line) that once leaked
+/// into the saved .log (glm53-flash-eugr-2x, 2026-09-12).
+/// `TTY_COMPATIBLE=0` (rich's own knob) renders non-interactively (bars
+/// silent, one final frame) while the pty keeps the deadlock workaround;
+/// `NO_COLOR=1` covers non-rich output.
 fn run_tool(
     bin: &str,
     args: &[String],
@@ -140,12 +136,15 @@ fn run_tool(
     } else {
         fs::File::create(log_path)?
     }));
-    let mut cmd = if std::process::Command::new("/usr/bin/script")
-        .arg("-q")
-        .arg("/dev/null")
-        .arg("true")
-        .output()
-        .is_ok()
+    // macOS-only (BSD `script`): util-linux `script` has no positional
+    // command and would parse the tool's own flags as its own.
+    let mut cmd = if cfg!(target_os = "macos")
+        && std::process::Command::new("/usr/bin/script")
+            .arg("-q")
+            .arg("/dev/null")
+            .arg("true")
+            .output()
+            .is_ok()
     {
         // Wrap in `sh` + `stty -onlcr`: the macOS pty's ONLCR would turn every
         // `\n` the tool writes into `\r\n` on disk, and the report viewer