File: command.rb

package info (click to toggle)
ruby-serverspec 2.42.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 980 kB
  • sloc: ruby: 4,835; makefile: 4
file content (31 lines) | stat: -rw-r--r-- 477 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require 'multi_json'

module Serverspec::Type
  class Command < Base
    def stdout
      command_result.stdout
    end

    def stdout_as_json
      MultiJson.load(command_result.stdout)
    end

    def stderr
      command_result.stderr
    end

    def exit_status
      command_result.exit_status.to_i
    end

    protected
    def command
      @name
    end

    private
    def command_result()
      @command_result ||= @runner.run_command(command)
    end
  end
end