Class: CommandLineScript

Inherits:
Object
  • Object
show all
Includes:
LoggerUtil
Defined in:
lib/jenkins_util/command_line_script.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from LoggerUtil

fatal, log, verbose?

Constructor Details

#initialize(command) ⇒ CommandLineScript

Returns a new instance of CommandLineScript.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/jenkins_util/command_line_script.rb', line 9

def initialize(command)
  @command = command

  LoggerUtil.log.debug("Executing: \"#{@command}\"")
  status = Open4.popen4(@command) do |pid, stdin, stdout, stderr|
    @pid = pid
    @stdin = stdin
    @stdout = stdout.readlines
    @error = stderr.readlines
  end

  @exit_status = status.exitstatus
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



7
8
9
# File 'lib/jenkins_util/command_line_script.rb', line 7

def command
  @command
end

#exit_statusObject (readonly)

Returns the value of attribute exit_status.



7
8
9
# File 'lib/jenkins_util/command_line_script.rb', line 7

def exit_status
  @exit_status
end

#pidObject (readonly)

Returns the value of attribute pid.



7
8
9
# File 'lib/jenkins_util/command_line_script.rb', line 7

def pid
  @pid
end

#stdinObject (readonly)

Returns the value of attribute stdin.



7
8
9
# File 'lib/jenkins_util/command_line_script.rb', line 7

def stdin
  @stdin
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



7
8
9
# File 'lib/jenkins_util/command_line_script.rb', line 7

def stdout
  @stdout
end

#sterrObject (readonly)

Returns the value of attribute sterr.



7
8
9
# File 'lib/jenkins_util/command_line_script.rb', line 7

def sterr
  @sterr
end