Skip to content

Commit 77bcc05

Browse files
committed
fix(logs): Tail logs from already exited unikernel
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]>
1 parent 0f51f3f commit 77bcc05

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/cli/kraft/logs/logs.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ func (opts *LogOptions) Run(ctx context.Context, args []string) error {
167167
if err != nil {
168168
errGroup = append(errGroup, err)
169169
}
170-
if opts.Follow && machine.Status.State == machineapi.MachineStateRunning {
170+
171+
// Sometimes the kernel can boot and exit faster than we can start tailing the logs
172+
if opts.Follow && (machine.Status.State == machineapi.MachineStateRunning || machine.Status.State == machineapi.MachineStateExited) {
171173
observations.Add(machine)
172174
go func(machine *machineapi.Machine) {
173175
defer func() {

0 commit comments

Comments
 (0)