Problem: I need to run an external program from Python which results in a new command prompt and I need to run some commands on the new command prompt.
I have gone through some of the posts related to this:
Python subprocess - run a second command in the new command prompt created How to run multiple commands synchronously from one subprocess.Popen command?
Even I have tried with os command as:
https://www.quora.com/How-do-I-control-command-prompt-by-using-python-scripts
With
proc = subprocess.Popen(['cli', '--log=cli.log', '--log-level=debug2'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
It seems that 'cli' is running in background and some input is awaited but when I check with ps command, no cli command exist in background and also I get error:
tcgetattr: Inappropriate ioctl for device
at command line. If I add stderr=subprocess.PIPE, the process gets existed immediately.