<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>a2ikm</author_name>
  <author_url>https://blog.hatena.ne.jp/a2ikm/</author_url>
  <blog_title>There's an echo in my head</blog_title>
  <blog_url>https://ikm.hatenablog.jp/</blog_url>
  <categories>
    <anon>ruby</anon>
  </categories>
  <description>Rubyで外部コマンドを実行する手段はいろいろあるけど、そのほとんどは実行し終わったときにまとめて標準出力等を得ることになる。時間がかかるコマンドを実行しつつその出力を随時受け取りたい場合にはOpen3.popen3を使う。 require &quot;open3&quot; Open3.popen3(&quot;long-long-command&quot;) do |stdin, stdout, stderr, wait_thr| stdin.close_write # 標準入力を閉じる。 begin # 標準出力、標準エラーの出力があるまで延々と待ち、随時1行ずつ書き出す loop do IO.select([stdout, …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fikm.hatenablog.jp%2Fentry%2F2014%2F11%2F12%2F003925&quot; title=&quot;外部コマンド実行時の標準出力、標準エラーを随時受け取る - There&amp;#39;s an echo in my head&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></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2014-11-12 00:39:25</published>
  <title>外部コマンド実行時の標準出力、標準エラーを随時受け取る</title>
  <type>rich</type>
  <url>https://ikm.hatenablog.jp/entry/2014/11/12/003925</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
