-
Notifications
You must be signed in to change notification settings - Fork 151
Accept an unset command
to proxy to an already started process (unmanaged process)
#339
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
Changes from 16 commits
50a4f28
f82e008
4afd012
e5ec689
9f94ca0
f7b5089
295afb1
e7935ab
e9ee439
2e740aa
f5257d6
a2b1df7
62ac65a
05107fe
ee31d7b
d261d3b
ebb8e35
d6fbbd8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -573,6 +573,7 @@ class SuperviseAndProxyHandler(LocalProxyHandler): | |
def __init__(self, *args, **kwargs): | ||
self.requested_port = 0 | ||
self.mappath = {} | ||
self.command = list() | ||
super().__init__(*args, **kwargs) | ||
|
||
def initialize(self, state): | ||
|
@@ -588,11 +589,14 @@ def port(self): | |
Allocate either the requested port or a random empty port for use by | ||
application | ||
""" | ||
if 'port' not in self.state: | ||
if 'port' not in self.state and self.command: | ||
sock = socket.socket() | ||
sock.bind(('', self.requested_port)) | ||
self.state['port'] = sock.getsockname()[1] | ||
sock.close() | ||
elif 'port' not in self.state: | ||
self.state['port'] = self.requested_port | ||
|
||
return self.state['port'] | ||
|
||
def get_cwd(self): | ||
|
@@ -650,6 +654,9 @@ async def ensure_process(self): | |
proc = SupervisedProcess(self.name, *cmd, env=server_env, ready_func=self._http_ready_func, ready_timeout=timeout, log=self.log) | ||
self.state['proc'] = proc | ||
|
||
if not cmd: | ||
return | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this called to late? Should If it is correct, a comment is needed to clarify why it is correct in my mind as this is quite unexpected for me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Besides this, the changes looks good to me! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Like it is now, it won't be awaited readiness either. I'll push a commit to move this logic upwards: d6fbbd8 |
||
try: | ||
await proc.start() | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.