Skip to content

Commit

Permalink
fix: signal.pause is not available on Windows (#5618)
Browse files Browse the repository at this point in the history
- Just use the `KeyboardInterrupt` to determine when to exist
- Simplifies the logic for both Windows and Unix based systems
- Seems to have no other side effects
- Also add `@Deprecated` annotation to the EmbeddedServer method that was marked as deprecated, get rid of a build warning
  • Loading branch information
mofojed committed Jun 18, 2024
1 parent c1ca8ce commit 5501712
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions py/embedded-server/deephaven_server/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ def server(host, port, jvm_args, extra_classpath, default_jvm_args):
)
click.echo("Press Control-C to exit")

def signal_handler(sig, frame):
try:
while True:
input()
except KeyboardInterrupt:
# signal_handler should already be called
click.echo("Exiting Deephaven...")
sys.exit(0)

signal.signal(signal.SIGINT, signal_handler)
signal.pause()
sys.exit(0)
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ interface Builder extends JettyServerComponent.Builder<Builder, PythonServerComp
*
* @deprecated use {@link #EmbeddedServer(String, Integer)} instead. dict is not used.
*/
@Deprecated
public EmbeddedServer(String host, Integer port, PyObject dict) throws IOException {
this(host, port);
}
Expand Down

0 comments on commit 5501712

Please sign in to comment.