diff --git a/lib/inspec/resources/processes.rb b/lib/inspec/resources/processes.rb index 4179eb795..2292763b0 100644 --- a/lib/inspec/resources/processes.rb +++ b/lib/inspec/resources/processes.rb @@ -138,7 +138,7 @@ module Inspec::Resources command: 8, } else - command = "ps axo label,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,user:32,command" + command = "ps wwaxo label,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,user:32,command" regex = /^(.+?)\s+(\d+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+(\w{3} \d{2}|\d{2}:\d{2}:\d{2})\s+([^ ]+)\s+([^ ]+)\s+(.*)$/ field_map = { label: 1, diff --git a/test/helpers/mock_loader.rb b/test/helpers/mock_loader.rb index e3c7bfb55..7e1f9ff42 100644 --- a/test/helpers/mock_loader.rb +++ b/test/helpers/mock_loader.rb @@ -210,7 +210,7 @@ class MockLoader 'find /sys/class/net/eth1/ -maxdepth 1 -type f -exec sh -c \'echo "[$(basename {})]"; cat {} || echo -n\' \;' => empty.call, "Get-Package -Name 'Not available' | ConvertTo-Json" => empty.call, "ps axo pid,pcpu,pmem,vsz,rss,tty,stat,start,time,user,command" => cmd.call("ps-axo"), - "ps axo label,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,user:32,command" => cmd.call("ps-axoZ"), + "ps wwaxo label,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,user:32,command" => cmd.call("ps-axoZ"), "ps -o pid,vsz,rss,tty,stat,time,ruser,args" => cmd.call("ps-busybox"), "env" => cmd.call("env"), "${Env:PATH}" => cmd.call("$env-PATH"), diff --git a/test/unit/resources/processes_test.rb b/test/unit/resources/processes_test.rb index 42e34a18d..a00a60483 100644 --- a/test/unit/resources/processes_test.rb +++ b/test/unit/resources/processes_test.rb @@ -228,6 +228,6 @@ describe "Inspec::Resources::Processes" do it "returns the correct command for non-busybox linux" do resource = MockLoader.new(:centos7).load_resource("processes") resource.expects(:busybox_ps?).returns(false) - _(resource.send(:ps_configuration_for_linux)[0]).must_equal "ps axo label,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,user:32,command" + _(resource.send(:ps_configuration_for_linux)[0]).must_equal "ps wwaxo label,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,user:32,command" end end