Hacker News new | past | comments | ask | show | jobs | submit login

Maybe a dumb question here. Why is a child process needed? Can the parent process not open a pipe, write its own state into the pipe, and then call exec, allowing the new binary to read from the pipe? Will exec destroy the pipe if there is no child process?





A pipe is a pipe, it's not a store. The buffer amount is not defined but usually you only get to write something like 512 bytes into it before it blocks.

(you could probably do the same thing by persisting state into a file, though)


Makes perfect sense, thank you.

Also, I looked it up, and apparently on Linux it's a 65536 byte buffer.


Pipes will block (eventually) if written to without a reader.



Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: