Skip to content

Instantly share code, notes, and snippets.

@hansnqyr
Created July 22, 2013 14:14
Show Gist options
  • Save hansnqyr/6054131 to your computer and use it in GitHub Desktop.
Save hansnqyr/6054131 to your computer and use it in GitHub Desktop.
COOK-2996 demonstrate issue with shell_out.run_command
require 'chef/mixin/shell_out'
include Chef::Mixin::ShellOut
download = %Q[ curl -L --cookie "oraclelicensejdk-7u25-b15-oth-JPR=accept-securebackup-cookie;gpw_e24=http://edelivery.oracle.com" http://download.oracle.com/otn-pub/java/jdk/7u25-b15/jdk-7u25-linux-x64.tar.gz -o jdk-7u25-linux-x64.tar.gz ]
extract = %Q[ tar xvzf jdk-7u25-linux-x64.tar.gz -C . ]
#parent & child pid are the same
download_cmd = shell_out(download)
puts download_cmd.inspect
#parent pid is same as previous, child pid is new
download_cmd.run_command
puts download_cmd.inspect
#exits with status code 2 on RHEL/CENTOS 6.4
puts shell_out(extract).exitstatus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment