22package signin
33
44import (
5+ "context"
56 "fmt"
67 "io/ioutil"
78 "net"
89 "net/http"
910 "net/url"
1011 "os"
1112 "strings"
12- "time"
1313
1414 "github.com/pkg/browser"
1515 "github.com/spf13/cobra"
@@ -19,7 +19,6 @@ import (
1919 "github.com/taskcluster/taskcluster/v44/clients/client-go/tcauth"
2020 "github.com/taskcluster/taskcluster/v44/clients/client-shell/cmds/root"
2121 "github.com/taskcluster/taskcluster/v44/clients/client-shell/config"
22- graceful "gopkg.in/tylerb/graceful.v1"
2322)
2423
2524var log = root .Logger
@@ -66,14 +65,11 @@ func cmdSignin(cmd *cobra.Command, _ []string) error {
6665 // Find port, choose 0 meaning random port, if none
6766 port , _ := cmd .Flags ().GetInt ("port" )
6867
69- // Setup server that we can shutdown gracefully
70- s := graceful.Server {
71- Timeout : 5 * time .Second ,
72- Server : & http.Server {},
73- }
68+ // Set up server for the redirect page after a successful sign in
69+ s := http.Server {}
7470
7571 // Handle callback
76- s .Server . Handler = http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
72+ s .Handler = http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
7773 qs := r .URL .Query ()
7874 csh , _ := cmd .Flags ().GetBool ("csh" )
7975 rootURL := config .RootURL ()
@@ -101,7 +97,9 @@ func cmdSignin(cmd *cobra.Command, _ []string) error {
10197 </body>
10298 </html>
10399 ` ))
104- s .Stop (50 * time .Millisecond )
100+ if err := s .Shutdown (context .Background ()); err != nil {
101+ log .Errorf ("Error shutting down server: %s\n " , err )
102+ }
105103 })
106104
107105 // Start listening on localhost
0 commit comments