Skip to content

Commit 85d6770

Browse files
maxproskendeloof
authored andcommitted
Fix panic when watch rebuilds without up
Signed-off-by: Max Proske <[email protected]>
1 parent 81d7d3c commit 85d6770

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

cmd/display/tty.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ func (w *ttyWriter) Done(operation string, success bool) {
178178
w.print()
179179
w.mtx.Lock()
180180
defer w.mtx.Unlock()
181-
w.ticker.Stop()
181+
if w.ticker != nil {
182+
w.ticker.Stop()
183+
}
182184
w.operation = ""
183185
w.done <- true
184186
}
@@ -202,12 +204,14 @@ func (w *ttyWriter) On(events ...api.Resource) {
202204

203205
func (w *ttyWriter) event(e api.Resource) {
204206
// Suspend print while a build is in progress, to avoid collision with buildkit Display
205-
if e.Text == api.StatusBuilding {
206-
w.ticker.Stop()
207-
w.suspended = true
208-
} else if w.suspended {
209-
w.ticker.Reset(100 * time.Millisecond)
210-
w.suspended = false
207+
if w.ticker != nil {
208+
if e.Text == api.StatusBuilding {
209+
w.ticker.Stop()
210+
w.suspended = true
211+
} else if w.suspended {
212+
w.ticker.Reset(100 * time.Millisecond)
213+
w.suspended = false
214+
}
211215
}
212216

213217
if last, ok := w.tasks[e.ID]; ok {

0 commit comments

Comments
 (0)