Ohai 'popen4 error'

Hi guys,

I have a quick question for you, is the following normal (chef-11.6 on windows):
irb(main):004:0> require ‘ohai/mixin/command’
=> true
irb(main):005:0>
irb(main):006:0*
irb(main):007:0*
irb(main):008:0*
irb(main):009:0* include Ohai::Mixin::Command
=> Object
irb(main):010:0>
irb(main):011:0*
irb(main):012:0*
irb(main):013:0* popen4(‘arp’)
NameError: uninitialized constant Fcntl::F_SETFD
from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai-6.18.0/lib/ohai/mixin/command.rb:167:in popen4' from (irb):13 from C:/opscode/chef/embedded/bin/irb:12:in'
irb(main):014:0>

I saw an old post regarding this issue in 2010, is there something I don’t understand?

Regards,
JM

On Tuesday, January 7, 2014 at 7:24 AM, Jeremy Mauro wrote:

Hi guys,

I have a quick question for you, is the following normal (chef-11.6 on windows):
irb(main):004:0> require 'ohai/mixin/command'
=> true
irb(main):005:0>
irb(main):006:0*
irb(main):007:0*
irb(main):008:0*
irb(main):009:0* include Ohai::Mixin::Command
=> Object
irb(main):010:0>
irb(main):011:0*
irb(main):012:0*
irb(main):013:0* popen4('arp')
NameError: uninitialized constant Fcntl::F_SETFD
from C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai-6.18.0/lib/ohai/mixin/command.rb:167:in popen4' from (irb):13 from C:/opscode/chef/embedded/bin/irb:12:in '
irb(main):014:0>

I saw an old post regarding this issue in 2010, is there something I don’t understand?

Regards,
JM

Ohai’s command mixin doesn’t support windows. You should use mixlib-shellout instead.

e.g.,

require ‘mixlib/shellout’

cmd = Mixlib::ShellOut.new(“arp”)
cmd.run_command
print cmd.stdout

--
Daniel DeLeo