Fix list_running_servers when runtime dir not created

I ran into this now that we actually use $XDG_RUNTIME_DIR, because it's
cleared on restart.
This commit is contained in:
Thomas Kluyver 2015-05-13 16:02:22 -07:00
parent 4be2c7957a
commit d80247a686

View File

@ -1126,6 +1126,11 @@ def list_running_servers(runtime_dir=None):
"""
if runtime_dir is None:
runtime_dir = jupyter_runtime_dir()
# The runtime dir might not exist
if not os.path.isdir(runtime_dir):
return
for file in os.listdir(runtime_dir):
if file.startswith('nbserver-'):
with io.open(os.path.join(runtime_dir, file), encoding='utf-8') as f: