# File lib/ohai/mixin/command.rb, line 31
      def run_command(args={})         
        if args.has_key?(:creates)
          if File.exists?(args[:creates])
            Ohai::Log.debug("Skipping #{args[:command]} - creates #{args[:creates]} exists.")
            return false
          end
        end
        
        stdout_string = nil
        stderr_string = nil
                
        args[:cwd] ||= Dir.tmpdir        
        unless File.directory?(args[:cwd])
          raise Ohai::Exceptions::Exec, "#{args[:cwd]} does not exist or is not a directory"
        end
        
        status = nil
        Dir.chdir(args[:cwd]) do
          if args[:timeout]
            begin
              Timeout.timeout(args[:timeout]) do
                status, stdout_string, stderr_string = systemu(args[:command])
              end
            rescue Exception => e
              Ohai::Log.error("#{args[:command_string]} exceeded timeout #{args[:timeout]}")
              raise(e)
            end
          else
            status, stdout_string, stderr_string = systemu(args[:command])
          end

          # systemu returns 42 when it hits unexpected errors
          if status.exitstatus == 42 and stderr_string == ""
            stderr_string = "Failed to run: #{args[:command]}, assuming command not found"
            Ohai::Log.debug(stderr_string)          
          end

          if stdout_string
            Ohai::Log.debug("---- Begin #{args[:command]} STDOUT ----")
            Ohai::Log.debug(stdout_string.strip)
            Ohai::Log.debug("---- End #{args[:command]} STDOUT ----")
          end
          if stderr_string
            Ohai::Log.debug("---- Begin #{args[:command]} STDERR ----")
            Ohai::Log.debug(stderr_string.strip)
            Ohai::Log.debug("---- End #{args[:command]} STDERR ----")
          end
        
          args[:returns] ||= 0
          args[:no_status_check] ||= false
          if status.exitstatus != args[:returns] and not args[:no_status_check]
            raise Ohai::Exceptions::Exec, "#{args[:command_string]} returned #{status.exitstatus}, expected #{args[:returns]}"
          else
            Ohai::Log.debug("Ran #{args[:command_string]} (#{args[:command]}) returned #{status.exitstatus}")
          end
        end
        return status, stdout_string, stderr_string
      end