From f14a361854945f2d064cc5156ecb977304dc8671 Mon Sep 17 00:00:00 2001 From: Dmitri Makarov Date: Sun, 19 Jun 2022 15:36:39 -0700 Subject: [PATCH] Fix build/test-bpf command line handling if run as cargo subcommand --- sdk/cargo-build-bpf/src/main.rs | 6 +++--- sdk/cargo-test-bpf/src/main.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/cargo-build-bpf/src/main.rs b/sdk/cargo-build-bpf/src/main.rs index 2d2be7c6de..9a9abcab96 100644 --- a/sdk/cargo-build-bpf/src/main.rs +++ b/sdk/cargo-build-bpf/src/main.rs @@ -21,9 +21,9 @@ fn main() { }; // When run as a cargo subcommand, the first program argument is the subcommand name. // Remove it - if let Some(arg1) = args.get(1) { - if arg1 == "build-bpf" { - args.remove(1); + if let Some(arg0) = args.get(0) { + if arg0 == "build-bpf" { + args.remove(0); } } print!("cargo-build-bpf child: {}", program.display()); diff --git a/sdk/cargo-test-bpf/src/main.rs b/sdk/cargo-test-bpf/src/main.rs index 424bac305f..891cfc7f20 100644 --- a/sdk/cargo-test-bpf/src/main.rs +++ b/sdk/cargo-test-bpf/src/main.rs @@ -27,9 +27,9 @@ fn main() { }; // When run as a cargo subcommand, the first program argument is the subcommand name. // Remove it - if let Some(arg1) = args.get(1) { - if arg1 == "test-bpf" { - args.remove(1); + if let Some(arg0) = args.get(0) { + if arg0 == "test-bpf" { + args.remove(0); } } print!("cargo-test-bpf child: {}", program.display());