We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 072f9f7 commit 50ccfcdCopy full SHA for 50ccfcd
src/term.rs
@@ -284,14 +284,7 @@ impl Term {
284
/// This does not include the trailing newline. If the terminal is not
285
/// user attended the return value will always be an empty string.
286
pub fn read_line(&self) -> io::Result<String> {
287
- if !self.is_tty {
288
- return Ok("".into());
289
- }
290
- let mut rv = String::new();
291
- io::stdin().read_line(&mut rv)?;
292
- let len = rv.trim_end_matches(&['\r', '\n'][..]).len();
293
- rv.truncate(len);
294
- Ok(rv)
+ self.read_line_initial_text("")
295
}
296
297
/// Read one line of input with initial text.
0 commit comments