From 15a66c7fb492b4dd920ab76e4f3eafe687b5e896 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Mon, 7 Sep 2020 03:17:20 +0000 Subject: [PATCH] fix showlogo crash when not connected to terminal --- src/onionrcommands/daemonlaunch/showlogo.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/onionrcommands/daemonlaunch/showlogo.py b/src/onionrcommands/daemonlaunch/showlogo.py index d301fbbf..5bf67d4f 100644 --- a/src/onionrcommands/daemonlaunch/showlogo.py +++ b/src/onionrcommands/daemonlaunch/showlogo.py @@ -28,10 +28,14 @@ from utils import logoheader def show_logo(): logger.raw('', terminal=True) + try: + terminal_size = os.get_terminal_size().columns + except OSError: # Generally thrown if not in terminal + terminal_size = 120 # print nice header thing :) if config.get('general.display_header', True): logoheader.header("") - if os.get_terminal_size().columns >= 120: + if terminal_size >= 120: if QUOTE[1]: # If there is an author to show for the quote logger.info( "\u001b[33m\033[F" + bordered(QUOTE[0] + '\n -' + QUOTE[1]),