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 <brendan.linn@gmail.com>
Co-authored-by: UebelAndre <github@uebelandre.com>
1 file changed
tree: 36a02531ed1fadc00dd08b38bfc6995d98757f88
  1. .bazelci/
  2. .github/
  3. bindgen/
  4. cargo/
  5. crate_universe/
  6. docs/
  7. examples/
  8. proto/
  9. rust/
  10. test/
  11. tools/
  12. util/
  13. wasm_bindgen/
  14. .bazelignore
  15. .bazelrc
  16. .gitignore
  17. ARCHITECTURE.md
  18. AUTHORS
  19. BUILD.bazel
  20. CODEOWNERS
  21. CONTRIBUTING.md
  22. CONTRIBUTORS
  23. LICENSE.txt
  24. README.md
  25. WORKSPACE.bazel
  26. workspace.bzl
README.md

Rust Rules

  • Postsubmit Build status
  • Postsubmit + Current Bazel Incompatible Flags Build status

Overview

This repository provides rules for building Rust projects with Bazel.

Community

Please refer to the full documentation.