thoughtbot / cocaine

A small library for doing (command) lines.
https://robots.thoughtbot.com
Other
785 stars 55 forks source link

ANSI color codes should check for tty first #30

Closed mperham closed 12 years ago

mperham commented 12 years ago

When using ANSI color codes, the correct thing to do is check if the output device is a tty? because stdout is often redirected to a file. For example:

logger = Logger.new(STDOUT)
logger.use_ansi = STDOUT.tty?

When I enable command logging through Paperclip, syslog fills up with this:

Oct 15 20:26:49 dt3 sidekiq[24443]: #033[32mCommand#033[0m :: file -b --mime :file
jyurek commented 12 years ago

Quite right! I just pushed a fix in f986c810610901a7c7b43bf01a72c7b031061f9f. Thanks for the report!