Take 2…

http://pastie.textmate.org/198959

Usage would become…

# Return the fds and pid, and echo any input to output
stdout, stderr, pid = TextMate::Process.async(cmd, :echo => true)

# Pass output to block, use TextMate::IO.sync = true, and don't echo input to output
TextMate::Process.async(cmd, :sync = true) do |str, fd|
  case fd
  when :out
    STDOUT << str
  when :err
    STDERR << str
  end
end

#Same as above but don't differentiate output
TextMate::Process.async(cmd, :sync = true) do |str|
  STDOUT << str
end

# Execute synchronously
out, err = TextMate::Process.sync(cmd, :echo = true)
STDOUT << outs
STDERR << err

Have to have a think about how to support returning stdout and stderr combined for sync().

LD.
_______________________________________________
textmate-dev mailing list
[email protected]
http://lists.macromates.com/mailman/listinfo/textmate-dev

Reply via email to