Skip to content

Commit 636728e

Browse files
committed
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>
1 parent e905857 commit 636728e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/bootstrap/setup.rs

+4
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ pub fn interactive_path() -> io::Result<Profile> {
152152
io::stdout().flush()?;
153153
let mut input = String::new();
154154
io::stdin().read_line(&mut input)?;
155+
if input == "" {
156+
eprintln!("EOF on stdin, when expecting answer to question. Giving up.");
157+
std::process::exit(1);
158+
}
155159
break match parse_with_abbrev(&input) {
156160
Ok(profile) => profile,
157161
Err(err) => {

0 commit comments

Comments
 (0)