git svn dcommit - >通过stdin传递密码

时间:2012-05-24 10:26:04

标签: python git git-svn command-line-interface

我正在尝试从python脚本运行“git svn dcommit”命令并处理我必须手动指定的密码。 该命令的标准输出是:

Committing to http://svn/trunk ...
Authentication realm: <http://svn:80> Active Directory credentials for users. Specific name and password for remote
Password for 'username':

此时,我必须指定密码。好的,我需要从stdout读取三行。

proc = subprocess.Popen(' git svn dcommit --username="username" ', shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
out = proc.stdout.readline()
print ":"+out
out = proc.stdout.readline()
print ":"+out
out = proc.stdout.readline()
print ":"+out
proc.stdin.write('password\n')

但是我得到了

:Committing to http://svn/trunk ...
Authentication realm: <http://svn:80> Active Directory credentials for users. Specific name and password for remote
Password for 'username':

之后,脚本正在等待“git svn dcommit”未提供的输出。它只读取第一行,就是这样。我怎样才能得到其余的输出?

谢谢。

0 个答案:

没有答案
相关问题