-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4eaa98a
commit c0dbc1e
Showing
1 changed file
with
2 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,4 @@ | ||
use std::io; | ||
use std::io::{Read, Write}; | ||
|
||
pub fn pause() { | ||
let mut stdin = io::stdin(); | ||
let mut stdout = io::stdout(); | ||
|
||
// We want the cursor to stay at the end of the line, so we print without a newline and flush manually. | ||
write!(stdout, "按回车键退出 Press enter to exit...").unwrap(); | ||
stdout.flush().unwrap(); | ||
|
||
// Read a single byte and discard | ||
let _ = stdin.read(&mut [0u8]).unwrap(); | ||
use std::process::Command; | ||
let _ = Command::new("cmd.exe").arg("/c").arg("pause").status(); | ||
} |