Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run adb commands through python?

Tags:

python

I've ten different adb commands and want to execute it concurrently as a separate process . I've used subprocess module & but process doesn't seem to run concurrently. Is there an efficient method in python to run process concurrently? My code snippet is below

def run(com):
       sub = subprocess.Popen(command, shell=True,
            stdout=subprocess.PIPE,
            stderr=subprocess.STDOUT)
    return sub.communicate()
cmd =[adb commands 1 to 10]
for i in cmd:
   run(i)
like image 673
MRSK Avatar asked Mar 29 '26 15:03

MRSK


1 Answers

This worked for me :

import subprocess
subprocess.call("adb devices",shell=True)

Here in place of "adb devices" you can write any adb commands.

like image 53
Vivek Gupta Avatar answered Mar 31 '26 04:03

Vivek Gupta



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!