Skip to content

Commit

Permalink
bfix: shutdown_server returns True when pid exists
Browse files Browse the repository at this point in the history
`check_pid` returns `True` if the PID for a notebook server still exists. Therefore, the `if check_pid(pid):` statements on lines 424 and 437 evaluate to `True` even though the notebook server is still running.

This commit simply adds a `not` to each line: `if not check_pid(pid):` so that the conditional only evaluates to `True` if `check_pid` returns `False`, which happens when the notebook server has shutdown, as expected.
  • Loading branch information
asreimer authored Jun 13, 2019
1 parent 6174498 commit dd0f5d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions notebook/notebookapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def shutdown_server(server_info, timeout=5, log=None):

# Poll to see if it shut down.
for _ in range(timeout*10):
if check_pid(pid):
if not check_pid(pid):
if log: log.debug("Server PID %s is gone", pid)
return True
time.sleep(0.1)
Expand All @@ -434,7 +434,7 @@ def shutdown_server(server_info, timeout=5, log=None):

# Poll to see if it shut down.
for _ in range(timeout * 10):
if check_pid(pid):
if not check_pid(pid):
if log: log.debug("Server PID %s is gone", pid)
return True
time.sleep(0.1)
Expand Down

0 comments on commit dd0f5d2

Please sign in to comment.