Sha256: d2ee6bcbb147d493591c32df283e3f032521acf2ea545437bcfc5e788522fc1e

Contents?: true

Size: 514 Bytes

Versions: 11

Compression:

Stored size: 514 Bytes

Contents

require 'tempfile'
module CommandLine
  def run command
    output = Tempfile.new("child")
    Dir.chdir SCRATCH do
      process = ChildProcess.build(*("#{command}".split(' ')))
      process.detach
      process.io.stdout = output
      process.io.stderr = output
      process.start
      wait_until(:timeout_after => 30.seconds) { process.exited? }
    end
    File.read(output.path)
  end

  def normalise text
    text.gsub(/[\n]/, ' ').gsub(/\s+/, ' ').strip
  end
end

World CommandLine
include CommandLine

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mirage-3.0.4 features/support/command_line.rb
mirage-3.0.3 features/support/command_line.rb
mirage-3.0.2 features/support/command_line.rb
mirage-3.0.1 features/support/command_line.rb
mirage-3.0.0 features/support/command_line.rb
mirage-3.0.0.alpha.17 features/support/command_line.rb
mirage-3.0.0.alpha.16 features/support/command_line.rb
mirage-3.0.0.alpha.15 features/support/command_line.rb
mirage-3.0.0.alpha.14 features/support/command_line.rb
mirage-3.0.0.alpha.13 features/support/command_line.rb
mirage-3.0.0.alpha.12 features/support/command_line.rb