From 8b9c98fe9aa5f9024806fefa87445d8ee318eacd Mon Sep 17 00:00:00 2001 From: Marius Kittler Date: Wed, 15 Mar 2023 18:48:20 +0100 Subject: [PATCH] Streamline "waiting" output between `openqa-cli` sub commands Related ticket: https://progress.opensuse.org/issues/125720 --- lib/OpenQA/CLI/schedule.pm | 2 +- lib/OpenQA/Command.pm | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/OpenQA/CLI/schedule.pm b/lib/OpenQA/CLI/schedule.pm index ddc9e258d4ba..36b5ae3335a7 100644 --- a/lib/OpenQA/CLI/schedule.pm +++ b/lib/OpenQA/CLI/schedule.pm @@ -37,7 +37,7 @@ sub _monitor_jobs ($self, $client, $poll_interval, $job_ids, $job_results) { push @$job_results, $job->{result} // NONE; next; } - print "Job state of job ID $job_id: $job_state, waiting…\n"; + print "Job state of job ID $job_id: $job_state, waiting …\n"; sleep $poll_interval; } } diff --git a/lib/OpenQA/Command.pm b/lib/OpenQA/Command.pm index 8214a77f26e8..bcacde848b76 100644 --- a/lib/OpenQA/Command.pm +++ b/lib/OpenQA/Command.pm @@ -11,6 +11,7 @@ use Mojo::Util qw(decode getopt); use Mojo::URL; use Mojo::File qw(path); use Term::ANSIColor qw(colored); +use open qw(:std :encoding(UTF-8)); my $JSON = Cpanel::JSON::XS->new->utf8->canonical->allow_nonref->allow_unknown->allow_blessed->convert_blessed ->stringify_infnan->escape_slash->allow_dupkeys->pretty; @@ -114,7 +115,7 @@ sub retry_tx ($self, $client, $tx, $handle_args, $retries = undef, $delay = unde $tx = $client->start($tx); my $res_code = $tx->res->code // 0; return $self->handle_result($tx, $handle_args) unless $res_code =~ /50[23]/ && $retries > 0; - print "Request failed, hit error $res_code, retrying up to $retries more times after waiting ...\n"; + print "Request failed, hit error $res_code, retrying up to $retries more times after waiting …\n"; sleep $delay; } }