Adjust run_command

This commit is contained in:
topjohnwu
2017-08-19 19:27:51 +08:00
parent 1ca9ec384b
commit e8e58f3fed
6 changed files with 34 additions and 31 deletions

View File

@@ -182,14 +182,12 @@ void proc_monitor() {
while (1) {
// Clear previous logcat buffer
char *const restart[] = { "logcat", "-b", "events", "-c", NULL };
log_pid = run_command(0, NULL, NULL, "/system/bin/logcat", restart);
if (log_pid > 0)
waitpid(log_pid, NULL, 0);
run_command(restart);
// Monitor am_proc_start
char *const command[] = { "logcat", "-b", "events", "-v", "raw", "-s", "am_proc_start", NULL };
log_fd = -1;
log_pid = run_command(0, &log_fd, NULL, "/system/bin/logcat", command);
log_pid = run_command2(0, &log_fd, NULL, command);
if (log_pid < 0) continue;
if (kill(log_pid, 0)) continue;