fix showlogo crash when not connected to terminal
This commit is contained in:
		
							parent
							
								
									37e5dbab4b
								
							
						
					
					
						commit
						15a66c7fb4
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		|  | @ -28,10 +28,14 @@ from utils import logoheader | ||||||
| 
 | 
 | ||||||
| def show_logo(): | def show_logo(): | ||||||
|     logger.raw('', terminal=True) |     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 :) |     # print nice header thing :) | ||||||
|     if config.get('general.display_header', True): |     if config.get('general.display_header', True): | ||||||
|         logoheader.header("") |         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 |             if QUOTE[1]:  # If there is an author to show for the quote | ||||||
|                 logger.info( |                 logger.info( | ||||||
|                     "\u001b[33m\033[F" + bordered(QUOTE[0] + '\n -' + QUOTE[1]), |                     "\u001b[33m\033[F" + bordered(QUOTE[0] + '\n -' + QUOTE[1]), | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue