Skip to content

Commit

Permalink
Reorganized webservice, fixes for progressbar,
Browse files Browse the repository at this point in the history
  • Loading branch information
lkarlslund committed Nov 23, 2021
1 parent d54bd1d commit 45bc999
Show file tree
Hide file tree
Showing 8 changed files with 964 additions and 906 deletions.
15 changes: 4 additions & 11 deletions modules/analyze/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package analyze

import (
"fmt"
"net/http"
"os/exec"
"runtime"

Expand All @@ -21,6 +20,8 @@ var (
bind = Command.Flags().String("bind", "127.0.0.1:8080", "Address and port of webservice to bind to")
nobrowser = Command.Flags().Bool("nobrowser", false, "Don't launch browser after starting webservice")
localhtml = Command.Flags().String("localhtml", "", "Override embedded HTML and use a local folder for webservice (for development)")

WebService = NewWebservice()
)

func init() {
Expand Down Expand Up @@ -155,19 +156,11 @@ func Execute(cmd *cobra.Command, args []string) error {
}
*/

quit := make(chan bool)

srv, err := webservice(*bind, quit, objs)
err = WebService.Start(*bind, objs)
if err != nil {
return err
}

go func() {
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
log.Fatal().Msgf("Problem launching webservice listener: %s", err)
}
}()

// Launch browser
if !*nobrowser {
var err error
Expand All @@ -188,6 +181,6 @@ func Execute(cmd *cobra.Command, args []string) error {
}

// Wait for webservice to end
<-quit
<-WebService.QuitChan()
return nil
}
Loading

0 comments on commit 45bc999

Please sign in to comment.