MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / run_cli

Function run_cli

crates/memtrack/src/cli.rs:37–64  ·  view source on GitHub ↗
(argv: I)

Source from the content-addressed store, hash-verified

35}
36
37pub fn run_cli<I, T>(argv: I) -> Result<i32>
38where
39 I: IntoIterator<Item = T>,
40 T: Into<OsString> + Clone,
41{
42 env_logger::builder()
43 .parse_env(env_logger::Env::new().filter_or("CODSPEED_LOG", "info"))
44 .format_timestamp(None)
45 .init();
46 crate::init_libbpf_logging();
47
48 let cli = Cli::parse_from(argv);
49
50 match cli.command {
51 Commands::Track {
52 command,
53 output: out_dir,
54 ipc_server,
55 } => {
56 debug!("Starting memtrack for command: {command}");
57
58 let status =
59 track_command(&command, ipc_server, &out_dir).context("Failed to track command")?;
60
61 Ok(status.code().unwrap_or(1))
62 }
63 }
64}
65
66/// Get the original user's UID and GID when running under sudo.
67/// Returns None if not running under sudo or if the environment variables are not set.

Callers 3

mainFunction · 0.70
runFunction · 0.50
runFunction · 0.50

Calls 2

init_libbpf_loggingFunction · 0.85
track_commandFunction · 0.70

Tested by

no test coverage detected