title: Chef compile error when capturing shell output
body: <p>I have a chef recipe that looks something like this:</p>
  
  <pre><code>package 'build-essential' do
    action :install
  end
  
  cmd = Mixlib::ShellOut.new("gcc -dumpversion")
  cmd.run_command
  gcc_version = cmd.stdout.strip()
  </code></pre>
  
  <p>If I execute the recipe on a system where gcc is installed, the recipe runs fine without errors. However, if I run the recipe on a system which doesn't have gcc install I get the error 'no such file or directory - gcc'.</p>
  
  <p>I came to know about the chef two-phases stuff when trying to find a solution to my problem. I was expecting the package installation to satisfy the gcc requirement. How can I tell chef that this requirement will be satisfied later and not throw an error at compile time?</p>
  
  <p>I tried the following, but the attribute does not get updated.</p>
  
  <pre><code>Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut)
  ruby_block "gcc_version" do
    block do
      s = shell_out("gcc -dumpversion")
      node.default['gcc_version'] = s.stdout.strip()
    end
  end
  
  echo "echo #{node[:gcc_version]}" do
    command "echo #{node[:gcc_version]}"
  end
  </code></pre>
  
  <p>Any help is appreciated. Thanks.</p>