Skip to content Skip to sidebar Skip to footer

Python Popen - How To Execute Commands In Nested Sub Shell Using Python

'I have an issue executing commands in nested adb sub shell in python. executing 'command_two' in adb shell opens a sub console in command line (and the console waits for input). h

Solution 1:

Please try this:

import time

R = subprocess.Popen('adb shell', shell=True, stdin=subprocess.PIPE)
R.communicate('command_one\n')
time.sleep(2)
R.communicate('command_two\n')

Post a Comment for "Python Popen - How To Execute Commands In Nested Sub Shell Using Python"