buildkite / terminal-to-html

Converts arbitrary shell output (with ANSI) into beautifully rendered HTML
http://buildkite.github.io/terminal-to-html
MIT License
642 stars 45 forks source link

APC with standard ST terminator would break parser #101

Closed pda closed 2 weeks ago

pda commented 1 year ago

Buildkite uses ANSI Application Program Commands to insert timestamps into log streams. Technically APCs are terminated by “String Terminator” (ST; 0x9C), however in practice the non-standard 7-bit-clean “Bell” (BEL, 0x07) alternative tends to be used:

For historical reasons, Xterm can end the command with BEL as well as the standard ST — https://en.wikipedia.org/wiki/ANSI_escape_code#OSC_(Operating_System_Command)_sequences

Our parser currently only supports BEL to terminate an APC. If an ST-terminated APC appeared in the log stream, our parser would miss everything until the next BEL or end-of-file.

This isn't an urgent issue, but maybe worth an easy fix one day.

Also described here as part of #99:

https://github.com/buildkite/terminal-to-html/blob/384f24c8de6053557dc46b25acce6667e7122576/parser.go#L141-L157