Class: IO

Inherits:
Object
  • Object
show all
Defined in:
lib/cem_acpt/utils/shell.rb,
lib/cem_acpt/provision/terraform/terraform_cmd.rb

Overview

IO monkey patch for non-blocking readline

Instance Method Summary collapse

Instance Method Details

#readline_nonblockObject



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/cem_acpt/utils/shell.rb', line 76

def readline_nonblock
  rlnb = []
  rnlb << read_nonblock(1) while rlnb[-1] != "\n"
  rlnb.join
rescue IO::WaitReadable => blocking
  raise blocking if rlnb.empty?

  rlnb.join
rescue EOFError
  rlnb.join
end