我目前有以下代码:
def run_commands(commands):
commands = commands.split()
process = subprocess.run(commands)
process.stdin.write("password")
output = run_commands("git clone ssh://git@git.com/opt/git/repository.git")
此代码最多可以使用process.stdin.write("password")
。它正在执行命令,然后等待密码输入,但是使用此write方法不会将任何内容写入命令窗口。我正在寻找的解决方案是能够运行命令,然后在同一命令窗口中键入内容,以便我可以输入密码。