Skip to content

Commit ad1de97

Browse files
committed
Auto merge of #4215 - alexcrichton:search-stdout, r=matklad
Switch `cargo search` output to stdout Closes #4203
2 parents 534ce68 + deda31f commit ad1de97

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/cargo/ops/registry.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -423,19 +423,17 @@ pub fn search(query: &str,
423423
}
424424
None => name
425425
};
426-
writeln!(config.shell().err(), "{}", line)?;
426+
println!("{}", line);
427427
}
428428

429429
let search_max_limit = 100;
430430
if total_crates > limit as u32 && limit < search_max_limit {
431-
writeln!(config.shell().err(),
432-
"... and {} crates more (use --limit N to see more)",
433-
total_crates - limit as u32)?;
431+
println!("... and {} crates more (use --limit N to see more)",
432+
total_crates - limit as u32);
434433
} else if total_crates > limit as u32 && limit >= search_max_limit {
435-
writeln!(config.shell().err(),
436-
"... and {} crates more (go to http://crates.io/search?q={} to see more)",
434+
println!("... and {} crates more (go to http://crates.io/search?q={} to see more)",
437435
total_crates - limit as u32,
438-
percent_encode(query.as_bytes(), QUERY_ENCODE_SET))?;
436+
percent_encode(query.as_bytes(), QUERY_ENCODE_SET));
439437
}
440438

441439
Ok(())

tests/search.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ fn simple() {
8484
assert_that(cargo_process("search").arg("postgres")
8585
.arg("--host").arg(registry().to_string()),
8686
execs().with_status(0)
87-
.with_stderr_contains("\
87+
.with_stdout_contains("\
8888
hoare = \"0.1.1\" # Design by contract style assertions for Rust"));
8989
}
9090

@@ -134,7 +134,7 @@ fn multiple_query_params() {
134134
assert_that(cargo_process("search").arg("postgres").arg("sql")
135135
.arg("--host").arg(registry().to_string()),
136136
execs().with_status(0)
137-
.with_stderr_contains("\
137+
.with_stdout_contains("\
138138
hoare = \"0.1.1\" # Design by contract style assertions for Rust"));
139139
}
140140

0 commit comments

Comments
 (0)