Skip to content

Commit

Permalink
Fixed an issue with out directories and stats file params
Browse files Browse the repository at this point in the history
- new versions of Clap panic with invalid utf8 passed to value_of_os()
  - clap-rs/clap#3344
  • Loading branch information
tkmcmaster committed Sep 8, 2022
1 parent 0f607e9 commit 93346a3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/bin/pewpew.rs
@@ -1,6 +1,6 @@
use std::{convert::TryInto, fs::create_dir_all, io, path::PathBuf, time::UNIX_EPOCH};
use std::{convert::TryInto, ffi::OsStr, fs::create_dir_all, io, path::PathBuf, time::UNIX_EPOCH};

use clap::{crate_version, Arg, Command};
use clap::{builder::ValueParser, crate_version, Arg, Command};
use config::duration_from_string;
use futures::channel::mpsc as futures_channel;
use log::{debug, info};
Expand Down Expand Up @@ -51,6 +51,7 @@ fn main() {
.long("stats-file")
.help("Specify the filename for the stats file")
.value_name("STATS_FILE")
.value_parser(ValueParser::os_string())
)
.arg(
Arg::new("start-at")
Expand All @@ -72,6 +73,7 @@ fn main() {
.number_of_values(1)
.help("Directory to store results and logs")
.value_name("DIRECTORY")
.value_parser(ValueParser::os_string())
)
.arg(
Arg::new("stats-file-format")
Expand Down Expand Up @@ -165,7 +167,7 @@ fn main() {
.value_of("CONFIG")
.expect("should have CONFIG param")
.into();
let results_dir = matches.value_of_os("results-directory").map(|d| {
let results_dir = matches.value_of_os("results-directory").map(|d: &OsStr| {
create_dir_all(d).unwrap();
PathBuf::from(d)
});
Expand Down

0 comments on commit 93346a3

Please sign in to comment.