Reputation: 16121
I want to execute a non-python program from within python. The non-python program prompts the user for a password so I want stdin to be routed to that subprocess. Similarly, the subprocess has some stdout which I want to be printed to the console. When the subprocess terminates, I would like the parent python program to continue executing.
This seems so simple yet I'm having a hard time figuring out how to do it. The problem is that there are too many ways to do something very similar (os.spawn, os.exec, commands., subprocess., etc).
Upvotes: 1
Views: 807
Reputation: 25666
subprocess.call(whatever, stdin=sys.stdout, stdout=sys.stdin)
However, are you sure that the password comes in through stdin? Command-line passwords generally use a different facility.
Upvotes: 3