Skip to content

Commit a1a3745

Browse files
committed
Flush after printing
1 parent f74fd69 commit a1a3745

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/bin/delete-crate.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ extern crate time;
1414

1515
use std::env;
1616
use std::io;
17+
use std::io::prelude::*;
1718

1819
use cargo_registry::Crate;
1920

@@ -43,6 +44,7 @@ fn delete(tx: &postgres::Transaction) {
4344

4445
let krate = Crate::find_by_name(tx, &name).unwrap();
4546
print!("Are you sure you want to delete {} ({}) [y/N]: ", name, krate.id);
47+
io::stdout().flush().unwrap();
4648
let mut line = String::new();
4749
io::stdin().read_line(&mut line).unwrap();
4850
if !line.starts_with("y") { return }
@@ -90,6 +92,7 @@ fn delete(tx: &postgres::Transaction) {
9092
println!(" {} deleted", n);
9193

9294
print!("commit? [y/N]: ");
95+
io::stdout().flush().unwrap();
9396
let mut line = String::new();
9497
io::stdin().read_line(&mut line).unwrap();
9598
if !line.starts_with("y") { panic!("aborting transaction"); }

src/bin/delete-version.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ extern crate semver;
1414

1515
use std::env;
1616
use std::io;
17+
use std::io::prelude::*;
1718

1819
use cargo_registry::{Crate, Version};
1920

@@ -50,6 +51,7 @@ fn delete(tx: &postgres::Transaction) {
5051
let v = Version::find_by_num(tx, krate.id, &version).unwrap().unwrap();
5152
print!("Are you sure you want to delete {}#{} ({}) [y/N]: ", name, version,
5253
v.id);
54+
io::stdout().flush().unwrap();
5355
let mut line = String::new();
5456
io::stdin().read_line(&mut line).unwrap();
5557
if !line.starts_with("y") { return }
@@ -68,6 +70,7 @@ fn delete(tx: &postgres::Transaction) {
6870
&[&v.id]).unwrap();
6971

7072
print!("commit? [y/N]: ");
73+
io::stdout().flush().unwrap();
7174
let mut line = String::new();
7275
io::stdin().read_line(&mut line).unwrap();
7376
if !line.starts_with("y") { panic!("aborting transaction"); }

0 commit comments

Comments
 (0)