mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 15:49:44 -05:00
fix(tools): command line args parsing bug, unused function parameter (#6629)
This commit is contained in:
parent
d52e4007c8
commit
e4e80f20c2
2 changed files with 6 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
|||
const addr = Deno.args[1] || "0.0.0.0:4544";
|
||||
const addr = Deno.args[0] || "0.0.0.0:4544";
|
||||
const [hostname, port] = addr.split(":");
|
||||
const listener = Deno.listen({ hostname, port: Number(port) });
|
||||
console.log("listening on", addr);
|
||||
|
|
|
@ -14,19 +14,17 @@ import third_party
|
|||
# "deno_http" was once called "deno_net_http"
|
||||
|
||||
DURATION = "20s"
|
||||
|
||||
LAST_PORT = 4544
|
||||
NEXT_PORT = 4544
|
||||
|
||||
|
||||
def server_addr(port):
|
||||
return "0.0.0.0:%s" % port
|
||||
|
||||
|
||||
def get_port(port=None):
|
||||
global LAST_PORT
|
||||
if port is None:
|
||||
port = LAST_PORT
|
||||
LAST_PORT = LAST_PORT + 1
|
||||
def get_port():
|
||||
global NEXT_PORT
|
||||
port = NEXT_PORT
|
||||
NEXT_PORT += 1
|
||||
# Return port as str because all usages below are as a str and having it an
|
||||
# integer just adds complexity.
|
||||
return str(port)
|
||||
|
|
Loading…
Reference in a new issue