Python - How To Hide Output After Killed Specified Process
now i try to create a python script to get Android logcats automatically below seciton is part of my codes logcat_process = subprocess.Popen('adb logcat -v time > logcat.log', s
Solution 1:
You can do something like this:
logcat_process = subprocess.Popen('adb logcat -v time > logcat.log', shell=True)
time.sleep(5)
save_stdout = sys.stdout
sys.stdout = open(r'/youlib..../trash.txt', 'w')
os.kill((logcat_process.pid)+1, signal.SIGKILL)
# regain stdout to screen
sys.stdout.close()
sys.stdout = save_stdout
It will divert the stdout to the trash.txt
file at the kill
operation.
Post a Comment for "Python - How To Hide Output After Killed Specified Process"