开发者

Communicating with interactive program?

I want to run the command:

svn ls --username xxx

from a script. It requests a password so I have to pass the开发者_JAVA百科 password to it. How I can do this in Ruby?


This is an excellent writeup about using the SVN Ruby bindings:

Using Subversion Ruby Bindings


You should be able to do something like:

require 'open3'

username = "xxx"
password = "xxx"

Open3.popen3("svn ls --username #{username}") do |stdin, stdout, stderr|
  stdin.puts(password)
  stdin.close
end

This comes straight out of my head, I haven't tested it so it might break in horrible ways. ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜