Skip to content

Commit e905857

Browse files
committed
x.py setup: Fix handling of wrong interactive input
We need a fresh input buffer each time, or we reuse the previous data (since `read_line` appends). Signed-off-by: Ian Jackson <[email protected]>
1 parent 6e9e040 commit e905857

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/bootstrap/setup.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ pub fn interactive_path() -> io::Result<Profile> {
140140
input.parse()
141141
}
142142

143-
let mut input = String::new();
144143
println!("Welcome to the Rust project! What do you want to do with x.py?");
145144
for (letter, profile) in abbrev_all() {
146145
println!("{}) {}: {}", letter, profile, profile.purpose());
@@ -151,6 +150,7 @@ pub fn interactive_path() -> io::Result<Profile> {
151150
abbrev_all().map(|(l, _)| l).collect::<Vec<_>>().join("/")
152151
);
153152
io::stdout().flush()?;
153+
let mut input = String::new();
154154
io::stdin().read_line(&mut input)?;
155155
break match parse_with_abbrev(&input) {
156156
Ok(profile) => profile,

0 commit comments

Comments
 (0)