Skip to content

Commit cbd7a8f

Browse files
Redirect resolver stdout to stderr (#139)
* Redirect resolver stdout to stderr The resolver subprocess (pak/renv) writes package install progress to stdout, which pollutes the script's actual output. Pipe the resolver's stdout and forward it to stderr so that `ir run script.R | cmd` works cleanly even on first run when packages need to be installed. Fixes #138 * Simplify resolver stdout-to-stderr redirect Use io::stderr() directly as the child's stdout target instead of piping through a forwarding thread. Available since Rust 1.74.
1 parent fc00371 commit cbd7a8f

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎src/runtime.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ fn resolve_library_inner(
437437
cmd.args(rscript_args)
438438
.arg(&driver)
439439
.stdin(Stdio::piped())
440-
.stdout(Stdio::inherit())
440+
.stdout(io::stderr())
441441
.stderr(Stdio::inherit())
442442
.env("IR_CACHE_DIR", cache_dir)
443443
// pak suppresses progress in noninteractive Rscript unless this is set.
@@ -519,7 +519,6 @@ fn resolve_library_inner(
519519
let current_status = child
520520
.wait()
521521
.map_err(|e| format!("failed to wait for dependency resolver: {e}"))?;
522-
523522
if tooling_restart_requested(&current_status, &restart_file) {
524523
if !retried_tooling_restart {
525524
retried_tooling_restart = true;

0 commit comments

Comments
 (0)