From eadcb5a067be2c289176c4ac22028e3ce305e840 Mon Sep 17 00:00:00 2001 From: Justin Hawkins Date: Tue, 21 Sep 2021 17:46:18 +0930 Subject: [PATCH] Remove some cruft and use exitcode to determine failure state --- main.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/main.go b/main.go index 1adf5d1..ea7f1ee 100644 --- a/main.go +++ b/main.go @@ -61,13 +61,6 @@ func main() { ReadTimeout: 0 * time.Second, } - go func() { - for { - //fmt.Printf("\n\n%#V\n\n", downloads) - time.Sleep(time.Second) - } - }() - log.Fatal(srv.ListenAndServe()) } @@ -92,7 +85,6 @@ func HomeHandler(w http.ResponseWriter, r *http.Request) { BookmarkletURL: template.URL(bookmarkletURL), } - log.Printf("%s", info.BookmarkletURL) err = t.ExecuteTemplate(w, "layout", info) if err != nil { panic(err) @@ -219,7 +211,10 @@ func queue(dl *download) { dl.Finished = true dl.ExitCode = cmd.ProcessState.ExitCode() - fmt.Printf("OBJ %#v\n", dl) + if dl.ExitCode != 0 { + dl.State = "failed" + } + } func updateDownload(r io.Reader, dl *download) {