Skip to content

Commit 58dd2ee

Browse files
committed
Moved stdout flushing to new flush()
1 parent 4a93848 commit 58dd2ee

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/console.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,14 @@ pub fn get_command_line_settings() -> CommandLineSettings {
8686
}
8787
}
8888

89-
pub fn confirm(message: impl Into<String>) -> bool {
90-
print!("{} [Y/N]: ", message.into());
91-
89+
pub fn flush() {
9290
stdout().flush().expect("Failed to flush stdout.");
91+
}
9392

93+
pub fn confirm(message: impl Into<String>) -> bool {
94+
print!("{} [Y/N]: ", message.into());
95+
flush();
96+
9497
let mut handle = stdin().lock();
9598
let mut ch = [0_u8];
9699

@@ -101,7 +104,7 @@ pub fn confirm(message: impl Into<String>) -> bool {
101104

102105
pub fn input(message: impl Into<String>) -> String {
103106
print!("{}", message.into());
104-
stdout().flush().expect("Failed to flush stdout.");
107+
flush();
105108

106109
let stdin = std::io::stdin();
107110
let mut res = String::new();

0 commit comments

Comments
 (0)