Class: Ndo::Process

Inherits:
Struct
  • Object
show all
Defined in:
lib/ndo/popen.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pidObject

Returns the value of attribute pid

Returns:

  • (Object)

    the current value of pid



3
4
5
# File 'lib/ndo/popen.rb', line 3

def pid
  @pid
end

#stderrObject

Returns the value of attribute stderr

Returns:

  • (Object)

    the current value of stderr



3
4
5
# File 'lib/ndo/popen.rb', line 3

def stderr
  @stderr
end

#stdinObject

Returns the value of attribute stdin

Returns:

  • (Object)

    the current value of stdin



3
4
5
# File 'lib/ndo/popen.rb', line 3

def stdin
  @stdin
end

#stdoutObject

Returns the value of attribute stdout

Returns:

  • (Object)

    the current value of stdout



3
4
5
# File 'lib/ndo/popen.rb', line 3

def stdout
  @stdout
end

Instance Method Details

#close_allObject



14
15
16
17
# File 'lib/ndo/popen.rb', line 14

def close_all
  [stdin, stdout, stderr].
    each(&:close)
end

#statusObject



4
5
6
7
# File 'lib/ndo/popen.rb', line 4

def status
  wait unless @status
  @status
end

#success?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/ndo/popen.rb', line 11

def success?
  status.success?
end

#waitObject



8
9
10
# File 'lib/ndo/popen.rb', line 8

def wait
  _, @status = ::Process.waitpid2(pid)
end