From 549ab3c160034b0d41464515ccd970b031dccc6d Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Tue, 9 Feb 2021 19:17:22 +1100 Subject: [PATCH] Buff issue 465 test command --- internal/cmd/issue-465/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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() } -- 2.44.0