-
-
Save TheOnlyArtz/df579c6ab6e7c1538498acaf5bdc09ab to your computer and use it in GitHub Desktop.
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
use std::{process::{Command , Stdio}, time::{Duration, Instant}}; | |
#[cfg(target_os = "windows")] | |
use std::os::windows::process::CommandExt; | |
fn main() { | |
let mut child = Command::new("cmd") | |
.args(["/c", "schtasks"]) | |
.creation_flags(0x08000000) | |
.stdout(Stdio::piped()) | |
.spawn() | |
.unwrap(); | |
// loop { | |
// std::thread::sleep(Duration::from_secs(1)); | |
// println!("Iteration!"); | |
// match child.try_wait() { | |
// Ok(Some(status)) => println!("exited with: {}", status), | |
// Ok(None) => { | |
// println!("status not ready yet, let's really wait"); | |
// let res = child.wait(); | |
// println!("result: {:?}", res); | |
// } | |
// Err(e) => println!("error attempting to wait: {}", e), | |
// } | |
// } | |
println!("Result: {:?}", child.wait_with_output()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment