Method: Cmds::IOHandler#initialize

Defined in:
lib/cmds/io_handler.rb

#initializeIOHandler

Returns a new instance of IOHandler.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cmds/io_handler.rb', line 10

def initialize
  @in = nil
  @out = $stdout
  @err = $stderr
  
  # Initialize a thread-safe queue for passing output from the IO threads
  # back to the main thread
  # 
  # NOTE  This used to be done in {#start}, but I was seeing intermittent
  #       failures on Travis from what look like thread race conditions,
  #       guessing that it's from output arriving before {#start} is
  #       called, which totally looks like it could happen.
  #       
  #       See the failure in
  #       
  #       https://travis-ci.org/nrser/qb/jobs/348609316
  #       
  #       Really, I'm surprised I haven't hit more issues with this
  #       half-ass threading shit.
  #       
  #       Anyways, I moved the queue creation here, see if it helps.
  # 
  @queue = Queue.new
  
  # Flag that is set to `true` when {#start} is called.
  @started = false
end