Skip to content

Commit cfb9fc0

Browse files
authored
Merge pull request #2833 from jyn514/completions
Fix infinite recursion in bash completions when `rustc` is not in PATH
2 parents 457d643 + b9f5a79 commit cfb9fc0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/cli/rustup_mode.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,9 @@ fn output_completion_script(shell: Shell, command: CompletionCommand) -> Result<
16861686

16871687
writeln!(
16881688
&mut term2::stdout(),
1689-
"source $(rustc --print sysroot){}",
1689+
"if command -v rustc >/dev/null 2>&1; then\n\
1690+
\tsource \"$(rustc --print sysroot)\"{}\n\
1691+
fi",
16901692
script,
16911693
)?;
16921694
}

0 commit comments

Comments
 (0)