]> Sergey Matveev's repositories - btrtrc.git/commitdiff
cmd/torrent: Include download stats on interrupt
authorMatt Joiner <anacrolix@gmail.com>
Mon, 20 Sep 2021 11:33:46 +0000 (21:33 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 20 Sep 2021 11:33:46 +0000 (21:33 +1000)
cmd/torrent/main.go

index 757ecdc75f2a75bea238211134a2ac17118bf685..385d732cae02bb34dad192f844f0263794d3d72e 100644 (file)
@@ -359,7 +359,7 @@ func downloadErr(flags downloadFlags) error {
        if client.WaitAll() {
                log.Print("downloaded ALL the torrents")
        } else {
-               return errors.New("y u no complete torrents?!")
+               err = errors.New("y u no complete torrents?!")
        }
        if flags.Seed {
                if len(client.Torrents()) == 0 {
@@ -378,7 +378,7 @@ func downloadErr(flags downloadFlags) error {
                humanize.Bytes(uint64(clStats.BytesRead.Int64())),
                100*float64(clStats.BytesReadUsefulData.Int64())/float64(clStats.BytesRead.Int64()),
                humanize.Bytes(uint64(sentOverhead)))
-       return nil
+       return err
 }
 
 func outputStats(cl *torrent.Client, args downloadFlags) {