I already have an android emulator instance open in the background. I want to write a python script that can use subprocess module to grep the logcat for a certain word, and return the latest (based on timestamp) result from that search as a string. How to do this?
adb logcat | grep keyword
>> 00:00:01 keyword
>> 00:00:02 keyword
>> 00:00:03 keyword
want python script that will return the line "00:00:03 keyword"
proc = subprocess.Popen(['adb', 'logcat', '| grep keyword'], stdout=subprocess.PIPE)
last_result=read_last_result(proc)