start_devserver: cleaner handling of signals

This simplified and robustifies the signal handling and termination of
the child process (devserver) in several ways:

* There's no need to set a flag when trapping a signal: it is sufficient
  to check the return status of the wait built-in (if >= 128, it was
  interrupted by a signal).

* Be sure to wait for the subprocess' termination, regardless of
  repeated signals. This ensures that we do not leave zombie devservers
  behind.

* Note that this may send multiple SIGTERMs to the child process (one
  for each signal trapped by start_devserver).  This is probably
  harmless, and makes the code simpler.

BUG=None
TEST=devserver killed cleanly

Change-Id: Ibe648285b461048f681e464ab2ba6c9a7445841d
Reviewed-on: https://gerrit.chromium.org/gerrit/32114
Reviewed-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
1 file changed