我正在尝试从 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':
此时,我必须指定密码。好的,我需要从标准输出读取三行。
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”未提供的输出。它只读取第一行,就是这样。我怎样才能得到其余的输出?
谢谢你。