Skip to content

Commit

Permalink
Rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
ulises-jeremias committed Oct 17, 2023
1 parent fb5b466 commit 5add41c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plot/show.v
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ pub fn (plot Plot) show() ! {
mut handler := PlotlyHandler{
plot: plot
}
listener := net.listen_tcp(net.AddrFamily.ip, ':0')!
mut server := &http.Server{
accept_timeout: 1 * time.second
listener: listener
port: 0
handler: handler
}
Expand All @@ -46,7 +48,11 @@ pub fn (plot Plot) show() ! {
for server.status() != .running {
time.sleep(10 * time.millisecond)
}
os.open_uri('http://${server.addr}')!
mut uri := 'http://${server.addr}'
for ip in ['0.0.0.0', '127.0.0.1'] {
uri = uri.replace(ip, 'localhost')
}
os.open_uri(uri)!
t.wait()
}
}
Expand Down

0 comments on commit 5add41c

Please sign in to comment.