From 1acb1daeee69cf28e97f0980f982a1afccd0df3b Mon Sep 17 00:00:00 2001 From: Mike Karlesky Date: Fri, 19 Apr 2024 16:58:47 -0400 Subject: [PATCH] More gracious terminal width discovery --- bin/app_cfg.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bin/app_cfg.rb b/bin/app_cfg.rb index 7a0740be..96a33d02 100755 --- a/bin/app_cfg.rb +++ b/bin/app_cfg.rb @@ -52,11 +52,18 @@ def initialize() # Default to `exit(1)` upon failing test cases :tests_graceful_fail => false, - # Get terminal width in columns - :terminal_width => (IO.console.winsize)[1], + # Set terminal width (in columns) to a default + :terminal_width => 120, } set_paths( ceedling_root_path ) + + # Try to query terminal width (not always available on all platforms) + begin + @app_cfg[:terminal_width] = (IO.console.winsize)[1] + rescue + # Do nothing; allow default value already set to stand + end end def set_project_config(config)