Skip to content

Commit 2ddb6ba

Browse files
committed
Add --startup-delay argument
1 parent 799061e commit 2ddb6ba

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

crates/ark/src/main.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ fn main() {
206206
let mut connection_file: Option<String> = None;
207207
let mut log_file: Option<String> = None;
208208
let mut startup_notifier_file: Option<String> = None;
209+
let mut startup_delay: Option<std::time::Duration> = None;
209210
let mut has_action = false;
210211
let mut capture_streams = true;
211212

@@ -254,6 +255,21 @@ fn main() {
254255
break;
255256
}
256257
},
258+
"--startup-delay" => {
259+
if let Some(delay_arg) = argv.next() {
260+
if let Ok(delay) = delay_arg.parse::<u64>() {
261+
startup_delay = Some(std::time::Duration::from_millis(delay));
262+
} else {
263+
eprintln!("Can't parse delay in milliseconds");
264+
break;
265+
}
266+
} else {
267+
eprintln!(
268+
"A delay in milliseconds must be specified with the --startup-delay argument."
269+
);
270+
break;
271+
}
272+
},
257273
other => {
258274
eprintln!("Argument '{}' unknown", other);
259275
break;
@@ -298,6 +314,10 @@ fn main() {
298314
}
299315
}
300316

317+
if let Some(delay) = startup_delay {
318+
std::thread::sleep(delay);
319+
}
320+
301321
// If the user didn't specify an action, print the usage instructions and
302322
// exit
303323
if !has_action {

0 commit comments

Comments
 (0)