Skip to content

Commit

Permalink
fix(containerlogs): avoid nil on empty log lines
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMurx authored and majormoses committed Jun 29, 2018
1 parent 91d5efe commit 0a97a54
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ This CHANGELOG follows the format listed at [Our CHANGELOG Guidelines ](https://
Which is based on [Keep A Changelog](http://keepachangelog.com/)

## [Unreleased]
### Fixed
- check-container-logs.rb: fix nil.gsub condition on empty log lines

## [3.1.0] - 2018-05-07
### Added
Expand Down
2 changes: 1 addition & 1 deletion bin/check-container-logs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def remove_headers(raw_logs)
lines = raw_logs.split("\n")
lines.map! do |line|
# Check only logs generated with the 8 bits control
if !line.nil? && /^(0|1|2)000$/ =~ line.byteslice(0, 4).unpack('C*').join('')
if !line.nil? && line.bytesize > 8 && /^(0|1|2)000$/ =~ line.byteslice(0, 4).unpack('C*').join('')
# Remove the first 8 bits and ansii colors too
line.byteslice(8, line.bytesize).gsub(/\x1b\[[\d;]*?m/, '')
end
Expand Down

0 comments on commit 0a97a54

Please sign in to comment.