From 8bc46fea362cef7900632a9587d8f5f540e5976e Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Fri, 15 Oct 2021 12:27:26 +0300 Subject: [PATCH] timeout utility replaces -max-secs --- INSTALL | 4 ++-- main.go | 11 ----------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/INSTALL b/INSTALL index 5317220..28a9b0b 100644 --- a/INSTALL +++ b/INSTALL @@ -19,7 +19,7 @@ Create daemontools+ucspi-tcp service: cd /path/to/pastes umask 027 exec setuidgid paster tcpserver -DHR -l 0 ::0 2020 \ - $GOPATH/bin/paster http://paster.example.com/ 2>&1 + timeout 1m $GOPATH/bin/paster http://paster.example.com/ 2>&1 EOF # cat > /var/service/.paster/log/run <&1 + timeout 1m $GOPATH/bin/paster http://paster.example.com/ 2>&1 diff --git a/main.go b/main.go index 9f65a79..34bdd4a 100644 --- a/main.go +++ b/main.go @@ -29,7 +29,6 @@ import ( "io" "os" "strconv" - "time" ) func fatal(s string) { @@ -38,7 +37,6 @@ func fatal(s string) { } func main() { - maxSecs := flag.Uint("max-secs", 60, "Maximal time of aliveness (0=disable)") maxSize := flag.Uint64("max-size", 1<<20, "Maximal upload size") flag.Usage = func() { fmt.Fprintf(os.Stderr, "Usage: paster [options] URL [...]\n") @@ -50,15 +48,6 @@ func main() { os.Exit(1) } var fn string - if *maxSecs > 0 { - go func() { - time.Sleep(time.Duration(*maxSecs) * time.Second) - if fn != "" { - os.Remove(fn) - } - fatal("max aliveness time is reached") - }() - } r := bufio.NewReader(os.Stdin) b, err := r.ReadByte() if err != nil { -- 2.44.0