Module: Exit_0::Child::Base
- Included in:
- Exit_0::Child
- Defined in:
- lib/Exit_0.rb
Instance Attribute Summary collapse
-
#child ⇒ Object
readonly
Returns the value of attribute child.
-
#cmd ⇒ Object
readonly
Returns the value of attribute cmd.
Instance Method Summary collapse
Instance Attribute Details
#child ⇒ Object (readonly)
Returns the value of attribute child.
46 47 48 |
# File 'lib/Exit_0.rb', line 46 def child @child end |
#cmd ⇒ Object (readonly)
Returns the value of attribute cmd.
46 47 48 |
# File 'lib/Exit_0.rb', line 46 def cmd @cmd end |
Instance Method Details
#initialize(*cmd) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/Exit_0.rb', line 47 def initialize *cmd if cmd[0].is_a?(String) if cmd[0]["\n"] cmd[0] = begin cmd[0] .split("\n") .map(&:strip) .reject(&:empty?) .join(" && ") end end cmd[0] = "bash -lc #{cmd[0].inspect}" end @child = POSIX::Spawn::Child.new(*cmd) @cmd = cmd.join(' ') end |
#split_lines ⇒ Object
67 68 69 |
# File 'lib/Exit_0.rb', line 67 def split_lines Split_Lines(child.out) end |
#status ⇒ Object
83 84 85 |
# File 'lib/Exit_0.rb', line 83 def status child.status end |