@@ -95,7 +95,11 @@ def th(s: str) -> str:
9595 props .add_row (th ("Inactivity duration" ), inactivity_duration )
9696 props .add_row (th ("Reservation" ), run_spec .configuration .reservation or "-" )
9797
98- offers = Table (box = None , expand = os .get_terminal_size ()[0 ] <= 110 )
98+ try :
99+ width = os .get_terminal_size ()[0 ]
100+ except OSError :
101+ width = 120 # Default width for non-TTY
102+ offers = Table (box = None , expand = width <= 110 )
99103 offers .add_column ("#" )
100104 offers .add_column ("BACKEND" , style = "grey58" , ratio = 2 )
101105 offers .add_column ("RESOURCES" , ratio = 4 )
@@ -149,7 +153,11 @@ def th(s: str) -> str:
149153def get_runs_table (
150154 runs : List [Run ], verbose : bool = False , format_date : DateFormatter = pretty_date
151155) -> Table :
152- table = Table (box = None , expand = os .get_terminal_size ()[0 ] <= 110 )
156+ try :
157+ width = os .get_terminal_size ()[0 ]
158+ except OSError :
159+ width = 120 # Default width for non-TTY
160+ table = Table (box = None , expand = width <= 110 )
153161 table .add_column ("NAME" , style = "bold" , no_wrap = True , ratio = 2 )
154162 table .add_column ("BACKEND" , style = "grey58" , ratio = 2 )
155163 table .add_column ("RESOURCES" , ratio = 3 if not verbose else 2 )
0 commit comments