your-tools / pycp

cp and mv with a progress bar
MIT License
147 stars 8 forks source link

pycp crashes when file size changes during transfer #15

Closed ghost closed 6 years ago

ghost commented 8 years ago

If the file size increases while it's being transferred, pycp may crash with an assertion failure here

def on_file_transfer():
    self.global_pbar.update(xferd) 

def fraction()
    res = float(curval) / maxval
    assert res > 0
    assert res < 1
    return res

We can't really assume that xferd will always be smaller than src file size !