diff options
| author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2020-10-13 18:25:17 +0100 |
|---|---|---|
| committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2020-10-14 11:40:53 +0100 |
| commit | 636728e39464b678646bdedfc47327898b464a66 (patch) | |
| tree | 62fb6a82b2bf90b92fbaf8ab3d9dab4f45be29bf | |
| parent | e9058571ce97dc8f3e5551ad38d1d59c2caa1c48 (diff) | |
| download | rust-636728e39464b678646bdedfc47327898b464a66.tar.gz rust-636728e39464b678646bdedfc47327898b464a66.zip | |
x.py setup: Avoid infinite loop if stdin is /dev/null
EOF is not an error; it just causes read_line to produce "". Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| -rw-r--r-- | src/bootstrap/setup.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bootstrap/setup.rs b/src/bootstrap/setup.rs index 6811a376ac0..a281061ace1 100644 --- a/src/bootstrap/setup.rs +++ b/src/bootstrap/setup.rs @@ -152,6 +152,10 @@ pub fn interactive_path() -> io::Result<Profile> { io::stdout().flush()?; let mut input = String::new(); io::stdin().read_line(&mut input)?; + if input == "" { + eprintln!("EOF on stdin, when expecting answer to question. Giving up."); + std::process::exit(1); + } break match parse_with_abbrev(&input) { Ok(profile) => profile, Err(err) => { |
