Class: Gherkin::Stream::SubprocessMessageStream

Inherits:
Object
  • Object
show all
Defined in:
lib/gherkin/stream/subprocess_message_stream.rb

Instance Method Summary collapse

Constructor Details

#initialize(gherkin_executable, paths, print_source, print_ast, print_pickles) ⇒ SubprocessMessageStream

Returns a new instance of SubprocessMessageStream.



7
8
9
# File 'lib/gherkin/stream/subprocess_message_stream.rb', line 7

def initialize(gherkin_executable, paths, print_source, print_ast, print_pickles)
  @gherkin_executable, @paths, @print_source, @print_ast, @print_pickles = gherkin_executable, paths, print_source, print_ast, print_pickles
end

Instance Method Details

#messagesObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gherkin/stream/subprocess_message_stream.rb', line 11

def messages
  args = [@gherkin_executable]
  args.push('--no-source') unless @print_source
  args.push('--no-ast') unless @print_ast
  args.push('--no-pickles') unless @print_pickles
  args = args.concat(@paths)
  stdin, stdout, stderr, wait_thr = Open3.popen3(*args)
  if(stdout.eof?)
    error = stderr.read
    raise error
  end
  Cucumber::Messages::BinaryToMessageEnumerator.new(stdout)
end