Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

Commit

Permalink
Wait for the last go routines to be done, before finishing up
Browse files Browse the repository at this point in the history
  • Loading branch information
morphar committed Aug 7, 2016
1 parent 8be65bc commit a21d834
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"strconv"
"strings"
"sync"
"time"

"golang.org/x/crypto/ssh/terminal"

Expand Down Expand Up @@ -328,7 +329,11 @@ func main() {
mediaLock.Unlock()
<-ch
}(ch, i, media)
}

// Wait for the last routines to be done
for len(ch) > 0 {
time.Sleep(500 * time.Millisecond)
}

mediaLock.Lock()
Expand Down

0 comments on commit a21d834

Please sign in to comment.