Skip to content

Commit

Permalink
Time: Parse CLI opts, run subprocess and extract resource usage
Browse files Browse the repository at this point in the history
  • Loading branch information
envp committed Mar 1, 2021
1 parent 4a884c5 commit 85b4688
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions time/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ description = "time a simple command"

[dependencies]
clap = { version = "^2.33.0", features = ["wrap_help"] }
coreutils_core = { path = "../coreutils_core" }

[build-dependencies]
clap = { version = "^2.33.0" }
11 changes: 10 additions & 1 deletion time/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
mod cli;
mod subprocess;

use coreutils_core::os::resource::{get_rusage, ResourceConsumer};

fn main() {
let _ = cli::create_app().get_matches();
let opts = cli::TimeOpts::new();
let (exit_status, duration) = match subprocess::timed_run(&opts.command) {
Ok(rv) => rv,
Err(err) => subprocess::exit_with_msg(err),
};

let usage = get_rusage(ResourceConsumer::Children);
}

0 comments on commit 85b4688

Please sign in to comment.