Top Level Namespace

Instance Method Summary collapse

Instance Method Details

#command_run(command_str) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/hq/cucumber/command.rb', line 33

def command_run command_str

  stdout_temp =
    Tempfile.new "cuke-command-stdout-"

  stderr_temp =
    Tempfile.new "cuke-command-stderr-"

  system "(%s) >%s 2>%s" % [
    command_str,
    stdout_temp.path,
    stderr_temp.path,
  ]

  @command_exit_status = $?.exitstatus

  @command_stdout =
    File.read stdout_temp.path

  @command_stderr =
    File.read stderr_temp.path

  stdout_temp.unlink
  stderr_temp.unlink

end