File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -168,11 +168,25 @@ func (q *TransferQueue) processBatch() error {
168168 return nil
169169}
170170
171+ func (q * TransferQueue ) endProcess () {
172+ close (q .errorc )
173+ for _ , watcher := range q .watchers {
174+ close (watcher )
175+ }
176+ }
177+
171178// Process starts the transfer queue and displays a progress bar. Process will
172179// do individual or batch transfers depending on the Config.BatchTransfer() value.
173180// Process will transfer files sequentially or concurrently depending on the
174181// Concig.ConcurrentTransfers() value.
175182func (q * TransferQueue ) Process () {
183+
184+ // Early out if nothing to do
185+ if len (q .transferables ) == 0 {
186+ q .endProcess ()
187+ return
188+ }
189+
176190 q .bar = pb .New64 (q .size )
177191 q .bar .SetUnits (pb .U_BYTES )
178192 q .bar .ShowBar = false
@@ -263,10 +277,7 @@ func (q *TransferQueue) Process() {
263277 }
264278
265279 q .wg .Wait ()
266- close (q .errorc )
267- for _ , watcher := range q .watchers {
268- close (watcher )
269- }
280+ q .endProcess ()
270281 close (progressc )
271282
272283 q .bar .Finish ()
You can’t perform that action at this time.
0 commit comments