Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: start server script #29

Merged
merged 3 commits into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions core/morph/task/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,24 @@ def emit(self, record):
def parse_sys_argv():
port = 8080

args = sys.argv[1:]
for i in range(len(args)):
if args[i] == "--port" and i + 1 < len(args):
filtered_args = []
skip_next = False
for i, arg in enumerate(sys.argv[1:]):
if skip_next:
skip_next = False
continue

if arg == "--port" and i + 1 < len(sys.argv):
try:
port = int(args[i + 1])
port = int(sys.argv[i + 2])
skip_next = True
except ValueError:
port = 8080
continue

filtered_args.append(arg)

sys.argv = [sys.argv[0]] + filtered_args

return port

Expand Down
Loading