Ajout : afficher un dollar dans stdout avant de taper une commande

This commit is contained in:
Hippolyte Chauvin 2023-10-28 15:40:27 +02:00
parent 675a176b77
commit 4c70fda118

View file

@ -1,4 +1,5 @@
use std::io;
use std::io::Write;
mod parser;
@ -8,6 +9,11 @@ fn main() {
while result_bytes_read.unwrap() != 0 {
buffer.clear();
print!("$ ");
if io::stdout().flush().is_err() {
eprintln!("error: can't fully flush stdout or reached EOF");
}
result_bytes_read = io::stdin().read_line(&mut buffer);
if !result_bytes_read.is_err() {