diff options
author | Zac Pullar-Strecker <zacmps@gmail.com> | 2018-10-27 17:47:01 +1300 |
---|---|---|
committer | Zac Pullar-Strecker <zacps@users.noreply.github.com> | 2018-10-28 10:53:01 +1300 |
commit | df82b5ffbdcc1cb2909f4078b435be3b46281694 (patch) | |
tree | e63d1dcdf95adad613642eca1d82eb62af830170 | |
parent | a54cc4ec60b374fd3fd57af204be8de1c242f4cc (diff) | |
download | alacritty-df82b5ffbdcc1cb2909f4078b435be3b46281694.tar.gz alacritty-df82b5ffbdcc1cb2909f4078b435be3b46281694.zip |
Explicitly detach from the console on exit
Without this cmd won't redraw it's prompt when alacritty exits
-rw-r--r-- | src/main.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 1a887a90..57a7ba2e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,7 +43,7 @@ use std::os::unix::io::AsRawFd; #[cfg(windows)] extern crate winapi; #[cfg(windows)] -use winapi::um::wincon::{AttachConsole, ATTACH_PARENT_PROCESS}; +use winapi::um::wincon::{AttachConsole, FreeConsole, ATTACH_PARENT_PROCESS}; use alacritty::cli; use alacritty::config::{self, Config}; @@ -63,7 +63,7 @@ fn main() { // to the console of the parent process, so we do it explicitly. This fails // silently if the parent has no console. #[cfg(windows)] - unsafe {AttachConsole(ATTACH_PARENT_PROCESS);} + unsafe { AttachConsole(ATTACH_PARENT_PROCESS); } // Load command line options and config let options = cli::Options::load(); @@ -272,5 +272,9 @@ fn run(mut config: Config, options: &cli::Options) -> Result<(), Box<Error>> { // FIXME patch notify library to have a shutdown method // config_reloader.join().ok(); + // Without explicitly detaching the console cmd won't redraw it's prompt + #[cfg(windows)] + unsafe { FreeConsole(); } + Ok(()) } |