Get the latest tech news

Way too many ways to wait on a child process with a timeout


Published on 2024-11-10 Windows is not covered at all in this article. Discussions: /r/programming, HN, Lobsters I often need to launch a program in the terminal in a retry loop.

There is a degenerate case where the give command to run is wrong (e.g. typo in the parameters) or the executable does not exist, and our program will happily retry it to the bitter end. Evidently this is not a rare opinion, looking at the development in these areas: process descriptors, the various expansions to the venerable fork with vfork, clone, clone3, clone6, a bazillion different ways to do I/O multiplexing, etc. If you only care about MacOS and BSDs (or accept to use libkqueue on Linux), you can use kqueue because it works out of the box with PIDs, you avoid signals completely, and it's used in all the big libraries out of there e.g. libuv.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Way

Way

Photo of Ways

Ways

Photo of Timeout

Timeout

Related news:

News photo

HTTP your way into Citrix's Virtual Apps and Desktops with fresh exploit code

News photo

The final season of What If...? storms its way onto Disney Plus this December

News photo

An Overwatch: Classic event will take fans all the way back to the beginning