How to answer to prompts automatically with python fabric?

后端 未结 6 1243
一个人的身影
一个人的身影 2020-11-29 23:42

I want to run a command which prompts me to enter yes/no or y/n or whatever. If I just run the command local(\"my_command\") then it stops and asks me for input

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 00:28

    I have used simple echo pipes to answer prompts with Fabric.

    run('echo "yes\n"| my_command')
    

提交回复
热议问题