Skip to content

Commit

Permalink
Merge pull request #4452 from wasmerio/fix-app-log-error
Browse files Browse the repository at this point in the history
CLI: Fix logic error in indexing in app logs command
  • Loading branch information
syrusakbary authored Feb 21, 2024
2 parents d3f02cb + 83d39de commit 8dd5464
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/cli/src/commands/app/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,20 @@ impl crate::commands::AsyncCliCommand for CmdAppLogs {
let mut rem = self.max;

while let Some(logs) = logs_stream.next().await {
let logs = logs?;
let mut logs = logs?;

let limit = std::cmp::max(logs.len(), rem);
let limit = std::cmp::min(logs.len(), rem);

let logs: Vec<_> = logs.drain(..limit).collect();

let logs = &logs[..limit];
if !logs.is_empty() {
let rendered = self.fmt.format.render(logs);
let rendered = self.fmt.format.render(&logs);
println!("{rendered}");

rem -= limit;
}

if !self.watch && rem == 0 {
if !self.watch || rem == 0 {
break;
}
}
Expand Down

0 comments on commit 8dd5464

Please sign in to comment.