зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1314466 - part 3, Fennec child processes are no longer forked so kill and waitpid do not work as expected and must gracefully handle error cases. r=billm
This commit is contained in:
Родитель
05b00d150a
Коммит
7687cf7959
|
@ -70,6 +70,11 @@ ProcessId GetProcId(ProcessHandle process) {
|
|||
bool KillProcess(ProcessHandle process_id, int exit_code, bool wait) {
|
||||
bool result = kill(process_id, SIGTERM) == 0;
|
||||
|
||||
if (!result && (errno == ESRCH)) {
|
||||
result = true;
|
||||
wait = false;
|
||||
}
|
||||
|
||||
if (result && wait) {
|
||||
int tries = 60;
|
||||
bool exited = false;
|
||||
|
@ -79,6 +84,9 @@ bool KillProcess(ProcessHandle process_id, int exit_code, bool wait) {
|
|||
if (pid == process_id) {
|
||||
exited = true;
|
||||
break;
|
||||
} else if (errno == ECHILD) {
|
||||
exited = true;
|
||||
break;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
|
|
Загрузка…
Ссылка в новой задаче