mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-17 00:18:05 +02:00
Add busy count for integration tests
Integration tests need to be notified when Lazygit is idle so they can progress to the next assertion / user action.
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
package tasks
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||
"github.com/sasha-s/go-deadlock"
|
||||
)
|
||||
|
||||
@ -18,11 +17,13 @@ type AsyncHandler struct {
|
||||
lastId int
|
||||
mutex deadlock.Mutex
|
||||
onReject func()
|
||||
onWorker func(func())
|
||||
}
|
||||
|
||||
func NewAsyncHandler() *AsyncHandler {
|
||||
func NewAsyncHandler(onWorker func(func())) *AsyncHandler {
|
||||
return &AsyncHandler{
|
||||
mutex: deadlock.Mutex{},
|
||||
mutex: deadlock.Mutex{},
|
||||
onWorker: onWorker,
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,7 +33,7 @@ func (self *AsyncHandler) Do(f func() func()) {
|
||||
id := self.currentId
|
||||
self.mutex.Unlock()
|
||||
|
||||
go utils.Safe(func() {
|
||||
self.onWorker(func() {
|
||||
after := f()
|
||||
self.handle(after, id)
|
||||
})
|
||||
|
Reference in New Issue
Block a user