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:
Randall Barker 2016-10-18 13:12:20 -07:00
Родитель 05b00d150a
Коммит 7687cf7959
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -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);