From dd0f5d2608b3e0501e1e2f94d5b1f42a467ae8fc Mon Sep 17 00:00:00 2001 From: Ashton Reimer Date: Thu, 13 Jun 2019 15:36:45 -0700 Subject: [PATCH] bfix: shutdown_server returns True when pid exists `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. --- notebook/notebookapp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index a1a2108267..ac97cf8479 100755 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -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) @@ -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)