<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>shinshin86</author_name>
  <author_url>https://blog.hatena.ne.jp/shinshin86/</author_url>
  <blog_title>at backyard</blog_title>
  <blog_url>https://shinshin86.hateblo.jp/</blog_url>
  <categories>
    <anon>Golang</anon>
    <anon>備忘録</anon>
  </categories>
  <description>Go初心者による備忘録のため、Go経験者にとっては当たり前の内容を書いていると思うことを先に書いておく exec.Commandの出力をCLI上に表示させる方法 Goでは exec.Command を利用することでシェル上でコマンドで実行するような形で、Goプログラムを通じてコマンドを実行できる。 例えば下記のような形で実行できる。 cmd := exec.Command(&quot;ls&quot;) err = cmd.Run() if err != nil { fmt.Printf(&quot;Command failed: %v\n&quot;, err) os.Exit(1) } ただ、このような書き方の場合、lsコマンド…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fshinshin86.hateblo.jp%2Fentry%2F2022%2F08%2F06%2F180442&quot; title=&quot;goでexec.Command実行時に出力結果やエラーログをコンソールに表示させたい - at backyard&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>2022-08-06 18:04:42</published>
  <title>goでexec.Command実行時に出力結果やエラーログをコンソールに表示させたい</title>
  <type>rich</type>
  <url>https://shinshin86.hateblo.jp/entry/2022/08/06/180442</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
