Defer the wait.Done() for greater resilience
This commit is contained in:
parent
096b6da385
commit
da9a48a012
@ -52,6 +52,7 @@ func init() {
|
|||||||
// calls wait.Done() when the final item after the channel is closed is done
|
// calls wait.Done() when the final item after the channel is closed is done
|
||||||
func checkoutWithChan(in <-chan *lfs.WrappedPointer, wait *sync.WaitGroup) {
|
func checkoutWithChan(in <-chan *lfs.WrappedPointer, wait *sync.WaitGroup) {
|
||||||
go func() {
|
go func() {
|
||||||
|
defer wait.Done()
|
||||||
// Fire up the update-index command
|
// Fire up the update-index command
|
||||||
cmd := exec.Command("git", "update-index", "-q", "--refresh", "--stdin")
|
cmd := exec.Command("git", "update-index", "-q", "--refresh", "--stdin")
|
||||||
updateIdxStdin, err := cmd.StdinPipe()
|
updateIdxStdin, err := cmd.StdinPipe()
|
||||||
@ -98,7 +99,6 @@ func checkoutWithChan(in <-chan *lfs.WrappedPointer, wait *sync.WaitGroup) {
|
|||||||
if err := cmd.Wait(); err != nil {
|
if err := cmd.Wait(); err != nil {
|
||||||
Panic(err, "Error updating the git index")
|
Panic(err, "Error updating the git index")
|
||||||
}
|
}
|
||||||
wait.Done()
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user