MCPcopy Create free account
hub / github.com/cargo-lambda/cargo-lambda / command

Method command

crates/cargo-lambda-build/src/compiler/cargo.rs:10–34  ·  view source on GitHub ↗
(cargo: &Build, options: &CargoCompilerOptions)

Source from the content-addressed store, hash-verified

8impl Cargo {
9 #[tracing::instrument(target = "cargo_lambda")]
10 pub(crate) async fn command(cargo: &Build, options: &CargoCompilerOptions) -> Result<Command> {
11 tracing::debug!("compiling with Cargo");
12
13 let (subcommand, extra_args) = cargo_subcommand(options);
14
15 let mut cmd = if let Some(subcommand) = subcommand {
16 let cmd = cargo.command();
17 let mut args = cmd.get_args().collect::<VecDeque<&OsStr>>();
18 // remove the `build` subcommand from the front.
19 let _ = args.pop_front();
20
21 let mut cmd = Command::new("cargo");
22 cmd.args(subcommand);
23 cmd.args(args);
24
25 cmd
26 } else {
27 cargo.command()
28 };
29
30 if let Some(extra) = extra_args {
31 cmd.args(extra);
32 }
33 Ok(cmd)
34 }
35}
36
37fn cargo_subcommand(options: &CargoCompilerOptions) -> (Option<Vec<String>>, Option<Vec<String>>) {

Callers 2

runtimeFunction · 0.45
cargo_commandFunction · 0.45

Calls 2

cargo_subcommandFunction · 0.85
newFunction · 0.85

Tested by

no test coverage detected