【发布时间】:2023-05-25 18:59:01
【问题描述】:
我正在编写一个 ruby 脚本,我想在其中执行 android logcat -v time 命令在子进程中并在一段时间后终止该进程(当父进程完成 xyz 时)。
例如我有:
childpid = Process.fork {
adb -s <device-serial> logcat -c
adb -s <device-serial> logcat -v time>/path-to-file/forkLog.log
}
sleep(30)
#parent do thing else here ...
Process.kill("SIGHUP", childpid) #kill the child process
根据我的阅读,adb logcat 代码是在另一个子进程中执行的,所以当我尝试执行 Process.kill 时,childpid 会停止,但它的子进程不会。
如何从父进程中杀死 logcat -v time>forklog.log 进程??
【问题讨论】:
标签: android ruby process android-logcat kill-process