Skip to content

Commit

Permalink
handle os errors when trying to clean the session directory
Browse files Browse the repository at this point in the history
just log them since there isn't much we can do,
better than failing
  • Loading branch information
totaam committed Aug 4, 2021
1 parent 119cc8a commit 86c134e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion xpra/scripts/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,16 @@ def rm_session_dir():
session_dir = os.environ.get("XPRA_SESSION_DIR")
if not session_dir or not os.path.exists(session_dir):
return
if not os.listdir(session_dir):
try:
session_files = os.listdir(session_dir)
except OSError as e:
from xpra.log import Logger
log = Logger("server")
log("os.listdir(%s)", session_dir, exc_info=True)
log.warn("Warning: cannot access '%s'", session_dir)
log.warn(" %s", e)
return
if not session_files:
try:
os.rmdir(session_dir)
except OSError as e:
Expand Down

0 comments on commit 86c134e

Please sign in to comment.