Skip to content

Commit

Permalink
handle invalid timeout argument more gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Mar 9, 2024
1 parent 1a05229 commit c403b49
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions xpra/gtk_common/auth_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,16 @@ def main():
from xpra.platform.gui import init as gui_init
gui_init()
if len(sys.argv)<2:
stderr_print(f"usage: {sys.argv[0]} 'message' [timeout-in-seconds]")
sys.exit(4)
stderr_print("usage: %s 'message' [timeout-in-seconds]", sys.argv[0])
return 4
info = sys.argv[1]
if len(sys.argv)>=3:
timeout = int(sys.argv[2])
try:
timeout = int(sys.argv[2])
except ValueError:
stderr_print("invalid timeout value")
stderr_print("usage: %s 'message' [timeout-in-seconds]", sys.argv[0])
return 4
else:
timeout = 600
w = AuthDialog(info=info, timeout=timeout)
Expand Down

0 comments on commit c403b49

Please sign in to comment.