Skip to content

Commit 67b664e

Browse files
committed
fix(complete): Flush completion traces
1 parent 2c7bc09 commit 67b664e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/bin/cargo/main.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,19 @@ fn main() {
3131

3232
let nightly_features_allowed = matches!(&*features::channel(), "nightly" | "dev");
3333
if nightly_features_allowed {
34+
let args = std::env::args_os();
35+
let current_dir = std::env::current_dir().ok();
3436
let completer =
3537
clap_complete::CompleteEnv::with_factory(|| cli::cli(&mut gctx)).var("CARGO_COMPLETE");
36-
completer.complete();
38+
if completer
39+
.try_complete(args, current_dir.as_deref())
40+
.unwrap_or_else(|e| {
41+
let mut shell = Shell::new();
42+
cargo::exit_with_error(e.into(), &mut shell)
43+
})
44+
{
45+
return;
46+
}
3747
}
3848

3949
let result = if let Some(lock_addr) = cargo::ops::fix_get_proxy_lock_addr() {

0 commit comments

Comments
 (0)