Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error printing in process_posix.rs #85

Merged
merged 1 commit into from
Oct 6, 2023
Merged

Improve error printing in process_posix.rs #85

merged 1 commit into from
Oct 6, 2023

Conversation

nico
Copy link
Contributor

@nico nico commented Oct 5, 2023

  • The posix_spawn_* family of functions returns != 0 on error, and the return is an error code that can be passed to strerror(). So check for != 0, not < 0. (Error codes that can be passed to strerror() are in practice > 0!) Rename check_posix to check_posix_spawn too, to make it clear it's only for checking return codes from functions in the posix_spawn_* family.

  • The normal C runtime functions return a code < 0 on error, and put the error code in errno. Add a check_ret_errno function and call that instead of check_posix for non-spawn functions.

* The posix_spawn_* family of functions returns != 0 on error,
  and the return is an error code that can be passed to strerror().
  So check for `!= 0`, not `< 0`. (Error codes that can be passed
  to strerror() are in practice > 0!) Rename `check_posix` to
  `check_posix_spawn` too, to make it clear it's only for checking
  return codes from functions in the posix_spawn_* family.

* The normal C runtime functions return a code < 0 on error, and
  put the error code in errno. Add a check_ret_errno function and
  call that instead of check_posix for non-spawn functions.
@evmar evmar merged commit 117dfc6 into evmar:main Oct 6, 2023
2 checks passed
@nico nico deleted the err branch October 6, 2023 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants