diff --git a/lib/resources/os_env.rb b/lib/resources/os_env.rb index 4859d70ef..fe7a0bf15 100644 --- a/lib/resources/os_env.rb +++ b/lib/resources/os_env.rb @@ -18,9 +18,8 @@ class OsEnv < Inspec.resource(1) def initialize(env) @osenv = env cmd = inspec.command("su - root -c 'echo $#{env}'") - return if cmd.exit_status != 0 - @content = cmd.stdout - @content = @content.chomp if !@content.nil? + @content = cmd.stdout.chomp + @content = nil if cmd.exit_status != 0 end def split