0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-29 08:58:01 -04:00

fix(tools): command line args parsing bug, unused function parameter (#6629)

This commit is contained in:
Bert Belder 2020-07-05 01:15:03 +02:00 committed by GitHub
parent d52e4007c8
commit e4e80f20c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

View file

@ -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);

View file

@ -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)