util/process_wrapper: system_posix.cc: use waitpid correctly (#755)
util/process_wrapper: system_posix.cc: use waitpid correctly (#755)

* util/process_wrapper: system_posix.cc: use waitpid correctly.

At head, System::Exec uses waitpid() to wait on a forked child and
return its exit status. but it uses the system call incorrectly. as
documented in man 2 waitpid, the WIFEXITED, WIFSIGNALED, etc. macros
must be used on the status returned by waitpid() to determine if the
child exited normally, was terminated, etc.

returning the raw integer returned by waitpid() as the overall exit
status, as happens currently, is nonportable. how a signal/exit
status/etc. is represented inside the integer has never been
standardized as part of posix, and i suspect that returning it can
cause bazel to get confused about the exit status of the action,
leading to #708.

Authored-by: Ubehebe <4f9b66c91cfaf483ce3ec095c5a9d0440d67ec00@gmail.com>
Co-authored-by: UebelAndre <64b2b6d12bfe4baae7dad3d018f8cbf6b0e7a044@uebelandre.com>
bazelbuild/rules_rust,bazelbuild/rules_rust,bazelbuild/rules_rust,bazelbuild/rules_rust,bazelbuild/rules_rust