Skip to content

Commit

Permalink
Clippy III
Browse files Browse the repository at this point in the history
  • Loading branch information
svartalf committed Mar 3, 2020
1 parent 80e8b35 commit b980a48
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions examples/wait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,22 @@ use heim::process;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let pid = env::args()
.nth(1)
.ok_or_else(|| {
eprintln!("Process PID is not passed as a CLI argument");
io::Error::from(io::ErrorKind::InvalidInput)
})?
.parse::<process::Pid>()?;
let process = process::get(pid).await?;
#[cfg(target_os = "linux")] // Not implemented yet for other platforms
{
let pid = env::args()
.nth(1)
.ok_or_else(|| {
eprintln!("Process PID is not passed as a CLI argument");
io::Error::from(io::ErrorKind::InvalidInput)
})?
.parse::<process::Pid>()?;

println!("Watching for process {} completion", pid);
#[cfg(target_os = "linux")] // Not implemented yet
process.wait().await?;
println!("Process {} had exited", pid);
let process = process::get(pid).await?;

println!("Watching for process {} completion", pid);
process.wait().await?;
println!("Process {} had exited", pid);
}

Ok(())
}

0 comments on commit b980a48

Please sign in to comment.