Class: Taski::Execution::TaskOutputPipe

Inherits:
Object
  • Object
show all
Defined in:
lib/taski/execution/task_output_pipe.rb

Overview

Manages a single IO pipe for capturing task output Each task gets its own dedicated pipe for stdout capture

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(task_class) ⇒ TaskOutputPipe

Returns a new instance of TaskOutputPipe.



10
11
12
13
14
# File 'lib/taski/execution/task_output_pipe.rb', line 10

def initialize(task_class)
  @task_class = task_class
  @read_io, @write_io = IO.pipe
  @write_io.sync = true
end

Instance Attribute Details

#read_ioObject (readonly)

Returns the value of attribute read_io.



8
9
10
# File 'lib/taski/execution/task_output_pipe.rb', line 8

def read_io
  @read_io
end

#task_classObject (readonly)

Returns the value of attribute task_class.



8
9
10
# File 'lib/taski/execution/task_output_pipe.rb', line 8

def task_class
  @task_class
end

#write_ioObject (readonly)

Returns the value of attribute write_io.



8
9
10
# File 'lib/taski/execution/task_output_pipe.rb', line 8

def write_io
  @write_io
end

Instance Method Details

#closeObject



24
25
26
27
# File 'lib/taski/execution/task_output_pipe.rb', line 24

def close
  close_write
  close_read
end

#close_readObject



20
21
22
# File 'lib/taski/execution/task_output_pipe.rb', line 20

def close_read
  @read_io.close unless @read_io.closed?
end

#close_writeObject



16
17
18
# File 'lib/taski/execution/task_output_pipe.rb', line 16

def close_write
  @write_io.close unless @write_io.closed?
end

#closed?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/taski/execution/task_output_pipe.rb', line 37

def closed?
  write_closed? && read_closed?
end

#read_closed?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/taski/execution/task_output_pipe.rb', line 33

def read_closed?
  @read_io.closed?
end

#write_closed?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/taski/execution/task_output_pipe.rb', line 29

def write_closed?
  @write_io.closed?
end