<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>kyagi</author_name>
  <author_url>https://blog.hatena.ne.jp/kyagi/</author_url>
  <blog_title>blog.ayakumo.net</blog_title>
  <blog_url>https://blog.ayakumo.net/</blog_url>
  <categories>
    <anon>rake</anon>
    <anon>shell</anon>
  </categories>
  <description>tee に渡すとカラー出力が打ち消されて色なしになってしまう 開発環境の構築などの定型処理は Rakefile でタスクを定義して、バッチ処理として実行しています。 この際にログも保持するようにしているのですが、単純に tee に渡すだけでは標準出力もログもカラー出力が打ち消されてしまうことに気がつきました。 $ rake init 2&gt;&amp;1 | tee -a init.log これを解決するためには unbuffer を利用すればよいことがわかりました。本来の unbuffer の使い方とは少し違いますが... ログもエスケープシーケンスつきの色つきで保存されているので、less -R で色…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog.ayakumo.net%2Fentry%2F2022%2F09%2F10%2F192732&quot; title=&quot;unbuffer と tee の組み合わせで標準出力とログのカラーを保持する - blog.ayakumo.net&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/k/kyagi/20221029/20221029191823.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2022-09-10 19:27:32</published>
  <title>unbuffer と tee の組み合わせで標準出力とログのカラーを保持する</title>
  <type>rich</type>
  <url>https://blog.ayakumo.net/entry/2022/09/10/192732</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
