Created
November 29, 2023 18:48
-
-
Save SCP002/e3693509d14acd86680ad66e44d149be to your computer and use it in GitHub Desktop.
Rust: Start windows process in new console using CREATE_NEW_CONSOLE creation flag.
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
// Add to your Cargo.toml: | |
// [dependencies] | |
// subprocess = { version = "0.2.10", git = "https://github.com/SCP002/rust-subprocess.git" } | |
use subprocess::Exec; | |
fn main() { | |
let exit_status = Exec::cmd("my-executable-name") | |
.arg("arg1") | |
.creation_flags(0x00000010) // CREATE_NEW_CONSOLE | |
.startup_info_flags(0) | |
.join() | |
.unwrap(); | |
println!("Exit status: {:?}", exit_status); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment