Class: Mnogootex::Job::Runner
Instance Attribute Summary collapse
-
#hid ⇒ Object
readonly
Returns the value of attribute hid.
-
#log_lines ⇒ Object
readonly
Returns the value of attribute log_lines.
Instance Method Summary collapse
- #alive? ⇒ Boolean
- #count_lines ⇒ Object
-
#initialize(cl:, chdir:) ⇒ Runner
constructor
A new instance of Runner.
- #successful? ⇒ Boolean
Constructor Details
#initialize(cl:, chdir:) ⇒ Runner
Returns a new instance of Runner.
10 11 12 13 14 |
# File 'lib/mnogootex/job/runner.rb', line 10 def initialize(cl:, chdir:) @log_lines = [] _, @stream, @thread = Open3.popen2e(*cl, chdir: chdir) @poller = start_poller end |
Instance Attribute Details
#hid ⇒ Object (readonly)
Returns the value of attribute hid.
8 9 10 |
# File 'lib/mnogootex/job/runner.rb', line 8 def hid @hid end |
#log_lines ⇒ Object (readonly)
Returns the value of attribute log_lines.
8 9 10 |
# File 'lib/mnogootex/job/runner.rb', line 8 def log_lines @log_lines end |
Instance Method Details
#alive? ⇒ Boolean
16 17 18 |
# File 'lib/mnogootex/job/runner.rb', line 16 def alive? @poller.alive? end |
#count_lines ⇒ Object
24 25 26 27 |
# File 'lib/mnogootex/job/runner.rb', line 24 def count_lines return log_lines.size unless alive? @ticks = [@ticks || -1, log_lines.size - 1].min + 1 end |
#successful? ⇒ Boolean
20 21 22 |
# File 'lib/mnogootex/job/runner.rb', line 20 def successful? @poller.value.exitstatus.zero? end |