Class: QDA::Filters::Win32Process::Win32popenIO

Inherits:
Object
  • Object
show all
Defined in:
lib/weft/filters/win32backtick.rb

Instance Method Summary collapse

Constructor Details

#initialize(hRead, hWrite, hError) ⇒ Win32popenIO

Returns a new instance of Win32popenIO.



176
177
178
179
180
# File 'lib/weft/filters/win32backtick.rb', line 176

def initialize (hRead, hWrite, hError)
  @hRead  = hRead
  @hWrite = hWrite
  @hError = hError
end

Instance Method Details

#readObject



186
187
188
189
# File 'lib/weft/filters/win32backtick.rb', line 186

def read
  sleep(0.01) while Win32Process::peek_named_pipe(@hRead).zero?
  Win32Process::read_file(@hRead)
end

#read_allObject



191
192
193
194
195
196
197
# File 'lib/weft/filters/win32backtick.rb', line 191

def read_all
  all = ''
  until (buffer = read).empty?
    all << buffer
  end
  all
end

#read_all_errObject



204
205
206
207
208
209
210
# File 'lib/weft/filters/win32backtick.rb', line 204

def read_all_err
  all = ''
  until (buffer = read_err).empty?
    all << buffer
  end
  all
end

#read_errObject



199
200
201
202
# File 'lib/weft/filters/win32backtick.rb', line 199

def read_err
  sleep(0.01) while Win32Process::peek_named_pipe(@hError).zero?
  Win32Process::read_file(@hError)
end

#write(data) ⇒ Object



182
183
184
# File 'lib/weft/filters/win32backtick.rb', line 182

def write data
  Win32Process::write_file(@hWrite, data.to_s)
end