Python Fabric: How to answer to keyboard input?

Why can't you just use pipes?

For example, for an automated auto accept, just use yes, that just outputs a neverending stream of y.

yes | rm *.txt


(source: wikimedia.org)


If you are looking for a user to confirm an operation, use the confrim method.

if fabric.contrib.console.confirm("You tests failed do you want to continue?"):
  #continue processing

Or if you are looking for a way to get input from the user, use the prompt method.

password = fabric.operations.prompt("What is your password?")