Skip to content

Commit

Permalink
fix(logs): Tail logs from already exited unikernel
Browse files Browse the repository at this point in the history
In the case of Xen, on fast applications, the logs
would have been called when the machine was already
in the exit state.

Signed-off-by: Andrei Stan <[email protected]>
  • Loading branch information
andreistan26 committed May 30, 2024
1 parent 77a036a commit 53b93b4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/cli/kraft/logs/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ func (opts *LogOptions) Run(ctx context.Context, args []string) error {
if err != nil {
errGroup = append(errGroup, err)
}
if opts.Follow && machine.Status.State == machineapi.MachineStateRunning {

// Sometimes the kernel can boot and exit faster than we can start tailing the logs
if opts.Follow && (machine.Status.State == machineapi.MachineStateRunning || machine.Status.State == machineapi.MachineStateExited) {
observations.Add(machine)
go func(machine *machineapi.Machine) {
defer func() {
Expand Down

0 comments on commit 53b93b4

Please sign in to comment.