aces / cbrain

CBRAIN is a flexible Ruby on Rails framework for accessing and processing of large data on high-performance computing infrastructures.
GNU General Public License v3.0
71 stars 43 forks source link

Strip ANSI sequences from captured task outputs before display. #849

Open prioux opened 5 years ago

prioux commented 5 years ago

Some programs colorize their outputs, so before sending back the stdout and stderr to be displayed in CBRAIN, let's strip those ANSI sequences. Maybe also let's escape or delete any other non-printable control characters, such as as ^H.

MontrealSergiy commented 5 years ago

sample perl script http://impson.tzo.com/~jdimpson/bin/script-declutter to interpret controls. A simple stripping Ruby snippet https://rosettacode.org/wiki/Strip_control_codes_and_extended_characters_from_a_string

MontrealSergiy commented 5 years ago

With a proper gem, colors can be rendered rather than stripped https://rubygems.org/gems/ansi-to-html/versions/0.0.3, https://buildkite.com/blog/terminal-open-source-ansi-to-html-renderer