From: Matt Joiner Date: Tue, 9 Feb 2021 08:17:22 +0000 (+1100) Subject: Buff issue 465 test command X-Git-Tag: v1.25.0~2 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=549ab3c160034b0d41464515ccd970b031dccc6d;p=btrtrc.git Buff issue 465 test command --- diff --git a/internal/cmd/issue-465/main.go b/internal/cmd/issue-465/main.go index 3fc95593..5407535d 100644 --- a/internal/cmd/issue-465/main.go +++ b/internal/cmd/issue-465/main.go @@ -12,7 +12,8 @@ import ( func main() { if err := dlTorrents("."); err != nil { - fmt.Fprintln(os.Stderr, err) + fmt.Fprintf(os.Stderr, "fatal error: %v\n", err) + os.Exit(1) } } @@ -23,6 +24,9 @@ func dlTorrents(dir string) error { if err != nil { return err } + http.HandleFunc("/torrentClientStatus", func(w http.ResponseWriter, r *http.Request) { + cl.WriteStatus(w) + }) ids := []string{ "urlteam_2021-02-03-21-17-02", "urlteam_2021-02-02-11-17-02", @@ -38,7 +42,7 @@ func dlTorrents(dir string) error { for _, id := range ids { t, err := addTorrentFromURL(cl, fmt.Sprintf("https://archive.org/download/%s/%s_archive.torrent", id, id)) if err != nil { - return err + return fmt.Errorf("downloading metainfo for %q: %w", id, err) } t.DownloadAll() }