Skip to content

Commit

Permalink
fix: multiplexed playback with empty lines (#1884)
Browse files Browse the repository at this point in the history
Encountered a multiplexed log file with empty line in the
beginning. Fix by skipping empty lines until we see a line
that we can recognize.
  • Loading branch information
tkurki authored Feb 10, 2025
1 parent ffd5c49 commit f581031
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/streams/autodetect.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ require('util').inherits(ToTimestamped, Transform)
// runs only once, self-assigns the actual transform functions
// on first call
ToTimestamped.prototype._transform = function (msg, encoding, done) {
//ignore empty lines in the beginning of the file, encountered in some cases
if (msg.trim().length === 0) {
done()
return
}

const line = msg.toString()
this.multiplexedFormat =
line.length > 16 && line.charAt(13) === ';' && line.split(';').length >= 3
Expand Down

0 comments on commit f581031

Please sign in to comment.