Skip to content

Fix error-handling for posix_spawn#3344

Merged
sporksmith merged 3 commits intoshadow:mainfrom
sporksmith:debug-pidfd-open
Jun 6, 2024
Merged

Fix error-handling for posix_spawn#3344
sporksmith merged 3 commits intoshadow:mainfrom
sporksmith:debug-pidfd-open

Conversation

@sporksmith
Copy link
Copy Markdown
Contributor

On failure, posix_spawn and related functions return the error code
directly instead of through errno. This fixes our handling of the return
codes to correctly detect and interpret errors from these functions.

@github-actions github-actions bot added the Component: Main Composing the core Shadow executable label Jun 6, 2024
@sporksmith sporksmith added this to the Code health and maintenance milestone Jun 6, 2024
@github-actions github-actions bot added the Component: Documentation In-repository documentation, under docs/ label Jun 6, 2024
@sporksmith sporksmith marked this pull request as ready for review June 6, 2024 17:18
On failure, `posix_spawn` and related functions return the error code
directly instead of through errno. This fixes our handling of the return
codes to correctly detect and interpret errors from these functions.
We were incorrectly passing a format string to `Result::expect`,
which just outputs the string without formatting.

We can use `unwrap_or_else` instead to do formatting, and avoid doing
the formatting in the non-error case.
@sporksmith sporksmith merged commit ecb3edd into shadow:main Jun 6, 2024
@sporksmith sporksmith deleted the debug-pidfd-open branch June 6, 2024 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Documentation In-repository documentation, under docs/ Component: Main Composing the core Shadow executable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants