filter_wait(3)

πŸ’– filter_wait(3) πŸ’–

okay bestie, you found your way into util/filter.h β€” welcome, this is the part of the manual where we deal with feelings about child processes. Also it's a section-3 page, so it's a library call. Pull up a chair. πŸŽ€


✨ NAME ✨

filter_wait β€” it wraps waitpid for you, decodes the exitcode, and spills the tea on why your filter quit. πŸ’…


🌸 SYNOPSIS 🌸

#include <util/filter.h>

NEOERR *filter_wait(pid_t pid, int options, int *exitcode);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • pid β†’ the process identifier you're waiting for, like you're refreshing their location. πŸ‘€
  • options β†’ the options you hand off to waitpid (go check wait(2), it's all there).

πŸ‘‘ DESCRIPTION πŸ‘‘

So here's the vibe: filter_wait is a little cozy blanket wrapped around the waitpid call. If that call fails, it raises an error with a description so you actually know what went down. No silent suffering. 🫢

Now the plot twist, and this part is important, bestie, don't skim it:

  • If you do ask for the exitcode, and the process exited with a code other than zero β€” we don't raise an error. Chill. It just hands you the code.
  • If you don't ask for the exitcode, and it's non-zero β€” yeah, we raise an error. Not sorry. πŸ’€
fr fr, read those two bullets twice. They are literally opposite situations and the whole function hinges on which one you're in. 😭

⭐ RETURN VALUE ⭐

  • exitcode β†’ the exitcode if the process existed normally. 🌈

πŸ’œ SEE ALSO πŸ’œ

(not the page linking to itself in its own SEE ALSO πŸ’€ iconic behaviour honestly, we don't question it, we respect it)


k byeeee, this page is brought to you by ClearSilver, dated 12 July 2007 β€” yeah she's vintage, she's a classic, she ate and left no crumbs. go write some filters bestie πŸ’–βœ¨πŸŽ€