Skip to content

Commit

Permalink
devtools: upgrade clap to unuse atty
Browse files Browse the repository at this point in the history
Crate `atty` has potential security issue and is unmaintained.

Signed-off-by: Jiaqi Gao <jiaqi.gao@intel.com>
  • Loading branch information
gaojiaqi7 authored and jyao1 committed Dec 15, 2023
1 parent ba59df9 commit 3980c7e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 126 deletions.
125 changes: 7 additions & 118 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion devtools/td-layout-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ edition = "2018"
name = "td-layout-config"

[dependencies]
clap = { version = "3.0", features = ["derive"] }
clap = { version = "4.0", features = ["derive"] }
Inflector = "0.11.4"
json5 = "0.3.0"
parse_int = "0.6.0"
Expand Down
2 changes: 1 addition & 1 deletion devtools/td-layout-config/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct Cli {
#[clap(short = 'o', long = "output")]
output: Option<String>,
/// Output to stdout
#[clap(short = 'p', long = "print", parse(from_flag))]
#[clap(short = 'p', long = "print")]
print_flag: bool,
}

Expand Down
2 changes: 1 addition & 1 deletion devtools/test-runner-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ edition = "2018"

[dependencies]
bootloader-locator = "0.0.4" # for locating the `bootloader` dependency on disk
clap = { version = "3.0", features = ["cargo"] }
clap = { version = "4.0", features = ["cargo"] }
locate-cargo-manifest = "0.2.0" # for locating the kernel's `Cargo.toml`
runner-utils = "0.0.2" # small helper functions for custom runners (e.g. timeouts)
10 changes: 5 additions & 5 deletions devtools/test-runner-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use clap::{arg, command};
use clap::{arg, command, ArgAction};
use std::{
io,
path::{Path, PathBuf},
Expand All @@ -37,19 +37,19 @@ fn main() {
.arg(
arg!([kernel] "Path of kernel file be executed by the virtual machine")
.required(true)
.allow_invalid_utf8(false),
.action(ArgAction::Set),
)
.arg(
arg!(
--"no-run" "Dry-run mode, do not actually spawn the virtual machine"
)
.required(false)
.allow_invalid_utf8(false),
.action(ArgAction::SetTrue),
)
.get_matches();

// Safe to unwrap because they are mandatory arguments.
let kernel = matches.value_of("kernel").unwrap();
let kernel = matches.get_one::<String>("kernel").unwrap();
let kernel_binary_path = {
let path = PathBuf::from(kernel);
path.canonicalize().expect(&format!(
Expand All @@ -61,7 +61,7 @@ fn main() {
let bios = create_disk_images(&kernel_binary_path);

//let output = matches.value_of("no-run")
if matches.is_present("no-run") {
if matches.get_flag("no-run") {
println!("Created disk image at `{}`", bios.display());
return;
}
Expand Down

0 comments on commit 3980c7e

Please sign in to comment.