about summary refs log tree commit diff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2020-10-13 12:44:23 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2020-10-14 11:40:53 +0100
commite9058571ce97dc8f3e5551ad38d1d59c2caa1c48 (patch)
treeb15875d3bd9395e1e8786150eb1e4c13b73330bd
parent6e9e040bf85dd27e503a8c7f70b3e4d360c40d58 (diff)
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 <ijackson@chiark.greenend.org.uk>
-rw-r--r--src/bootstrap/setup.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bootstrap/setup.rs b/src/bootstrap/setup.rs
index 2119747d9e1..6811a376ac0 100644
--- a/src/bootstrap/setup.rs
+++ b/src/bootstrap/setup.rs
@@ -140,7 +140,6 @@ pub fn interactive_path() -> io::Result<Profile> {
         input.parse()
     }
 
-    let mut input = String::new();
     println!("Welcome to the Rust project! What do you want to do with x.py?");
     for (letter, profile) in abbrev_all() {
         println!("{}) {}: {}", letter, profile, profile.purpose());
@@ -151,6 +150,7 @@ pub fn interactive_path() -> io::Result<Profile> {
             abbrev_all().map(|(l, _)| l).collect::<Vec<_>>().join("/")
         );
         io::stdout().flush()?;
+        let mut input = String::new();
         io::stdin().read_line(&mut input)?;
         break match parse_with_abbrev(&input) {
             Ok(profile) => profile,