Skip to content

Commit fc4128e

Browse files
committed
chore: Add timeout to version check
1 parent 80fc4e1 commit fc4128e

File tree

1 file changed

+5
-3
lines changed
  • rust/stackablectl/src/cli

1 file changed

+5
-3
lines changed

rust/stackablectl/src/cli/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ impl Cli {
232232
check_version_in_background,
233233
true,
234234
);
235+
let release_check_future =
236+
tokio::time::timeout(std::time::Duration::from_secs(2), release_check_future);
235237

236238
#[rustfmt::skip]
237239
let command_future = async move {
@@ -255,14 +257,14 @@ impl Cli {
255257
let (release_check_result, command_result) =
256258
tokio::join!(release_check_future, command_future);
257259

258-
// NOTE (@Techassi): This is feaking ugly (I'm sorry) but there seems to be no other better
260+
// NOTE (@Techassi): This is freaking ugly (I'm sorry) but there seems to be no other better
259261
// way to achieve what we want without reworking the entire output handling/rendering
260262
// mechanism.
261263
// FIXME (@Techassi): This currently messes up any structured output. This is also not
262264
// trivially solved as explained above.
263265
match command_result {
264266
Ok(command_output) => {
265-
let output = if let Ok(Some(release_check_output)) = release_check_result {
267+
let output = if let Ok(Ok(Some(release_check_output))) = release_check_result {
266268
format!("{command_output}\n\n{release_check_output}")
267269
} else {
268270
command_output
@@ -271,7 +273,7 @@ impl Cli {
271273
Ok(output)
272274
}
273275
Err(err) => {
274-
if let Ok(Some(release_check_output)) = release_check_result {
276+
if let Ok(Ok(Some(release_check_output))) = release_check_result {
275277
indicatif_eprintln!("{release_check_output}\n");
276278
}
277279

0 commit comments

Comments
 (0)