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

Function run

src/cli/samply.rs:13–37  ·  view source on GitHub ↗
(args: SamplyArgs)

Source from the content-addressed store, hash-verified

11}
12
13pub fn run(args: SamplyArgs) -> Result<()> {
14 use ::samply::cli;
15
16 let argv = std::iter::once(std::ffi::OsString::from("samply")).chain(args.args);
17 let opt = cli::Opt::parse_from(argv);
18
19 // samply spins up its own tokio runtime internally, so it must run on a
20 // thread that isn't already inside our `#[tokio::main]` runtime.
21 std::thread::scope(|s| {
22 s.spawn(|| match opt.action {
23 #[cfg(any(
24 target_os = "android",
25 target_os = "macos",
26 target_os = "linux",
27 target_os = "windows"
28 ))]
29 cli::Action::Record(a) => ::samply::do_record_action(a),
30 _ => unimplemented!("Only `samply record` is supported"),
31 })
32 .join()
33 .map_err(|_| anyhow::anyhow!("samply thread panicked"))
34 })?;
35
36 Ok(())
37}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected