Terminate the "logcat" process started by my application using Python
<p>I have created one small application having a button tapping on which will start the "adb logcat" process, but after starting this process we have to give Ctrl+C command to stop it.
I want to make it generic so don't want to use Ctrl+C command and want to terminate it itself after few seconds (say 5 secs). </p>

<h2>code that start executing on tapping the button is:</h2>

<pre><code>def LOGGER():
    buildID=os.popen("adb shell getprop ro.build.id").read().strip()
    device=os.popen("adb shell getprop ro.product.device").read().strip()
    Log = ("D:\\Profiles\\hjv743\\Desktop\\Logs\\"+device+"_"+buildID)
    if not os.path.isdir(Log):
        os.mkdir(Log)
    os.system("adb pull /data/logger "+Log+"\\flash")
    os.system("adb pull /sdcard-ext/logger "+Log+"\\sdcard-ext")
</code></pre>

<hr>

<p>I have tried killing the process using its pid but it does not terminate it and it continues to run in background (Needless to mention the process name is always "logcat" as the process is adb logcat)</p>

<p>Also during this complete process my <em>application kept hung as the process is running</em>, so I cannot have another button (using Tkinter) tapping on which will terminate the running process. So the only option left with me is to terminate it automatically after some time.
This is very important for my applications as I cannot interact with it during the whole process.</p>

<p>Am I doing this wrong way and there any other way of doing the same process. Can I start the (adb logcat) process as a process in background and introduce one more button which will fetch the pid and will terminate it manually.</p>

<p>Any help is appreciated.</p>
