Skip to main content

Deprecation: run_command and popen4 helper method removal (OHAI-3)

Ohai ships a command mixin for use by plugin authors in shelling out to external commands. This mixin originally included run_command and popen4 methods, which were deprecated in Ohai 8.11.1 (Chef Infra Client 12.8.1) in favor of the more robust mixlib-shellout gem functionality. In Chef Infra Client 13 these deprecated methods will be removed, breaking any Ohai plugins authored using the deprecated methods.


Plugins should be updated to use mixlib-shellout instead of the run_command.

Deprecated run_command based code:

status, stdout, stderr = run_command(command: 'myapp --version')
if status == 0
  version = stdout

Updated code for mixlib shellout:

so = shell_out('myapp --version')
if so.exitstatus == 0
  version = so.stdout

See the mixlib-shellout repo for additional usage information.

Edit this page on GitHub

Thank you for your feedback!


Search Results