Skip to content

Commit

Permalink
prevent negative argument error for message formatting (fastlane#20857)
Browse files Browse the repository at this point in the history
  • Loading branch information
Akseli Lukkarila authored Nov 16, 2022
1 parent 8b307b1 commit 7cb9367
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fastlane_core/lib/fastlane_core/ui/implementations/shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,13 @@ def verbose(message)

def header(message)
format = format_string
if message.length + 8 < TTY::Screen.width - format.length
# clamp to zero to prevent negative argument error below
available_width = [0, TTY::Screen.width - format.length].max
if message.length + 8 < available_width
message = "--- #{message} ---"
i = message.length
else
i = TTY::Screen.width - format.length
i = available_width
end
success("-" * i)
success(message)
Expand Down

0 comments on commit 7cb9367

Please sign in to comment.