Skip to content

Commit 85b54cc

Browse files
fix(build): suppress bare stdout path in interactive terminals
Only print the bare binary path to stdout when stdout is piped (for scripting via $(piano build)). In interactive terminals, the user already sees the "built: <path>" line on stderr. Closes #73
1 parent 6aa1e8f commit 85b54cc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::collections::HashSet;
2+
use std::io::IsTerminal;
23
use std::path::{Path, PathBuf};
34
use std::process;
45

@@ -311,7 +312,9 @@ fn cmd_build(
311312
let binary = build_instrumented(staging.path(), &target_dir, package_name.as_deref())?;
312313

313314
eprintln!("built: {}", binary.display());
314-
println!("{}", binary.display());
315+
if !std::io::stdout().is_terminal() {
316+
println!("{}", binary.display());
317+
}
315318

316319
Ok(())
317320
}

0 commit comments

Comments
 (0)