mirror of
https://github.com/samuelncui/acp.git
synced 2025-12-23 05:05:15 +00:00
feat: change shortcut
This commit is contained in:
11
copy.go
11
copy.go
@@ -73,11 +73,6 @@ func (c *Copyer) copy(ctx context.Context, prepared <-chan *writeJob) <-chan *ba
|
||||
return
|
||||
}
|
||||
|
||||
if noSpaceDevices.Contains(lo.Map(job.targets, func(target string, _ int) string { return c.getDevice(target) })...) {
|
||||
job.fail("", ErrTargetNoSpace)
|
||||
continue
|
||||
}
|
||||
|
||||
wrap(ctx, func() { c.write(ctx, job, ch, cntr, noSpaceDevices) })
|
||||
}
|
||||
}
|
||||
@@ -98,6 +93,12 @@ func (c *Copyer) write(ctx context.Context, job *writeJob, ch chan<- *baseJob, c
|
||||
ch <- job.baseJob
|
||||
}()
|
||||
|
||||
// shortcut
|
||||
if noSpaceDevices.Contains(lo.Map(job.targets, func(target string, _ int) string { return c.getDevice(target) })...) {
|
||||
job.fail("", ErrTargetNoSpace)
|
||||
return
|
||||
}
|
||||
|
||||
atomic.AddInt64(&cntr.files, 1)
|
||||
chans := make([]chan []byte, 0, len(job.targets)+1)
|
||||
defer func() {
|
||||
|
||||
Reference in New Issue
Block a user