You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to use posix-spawn for shell commands?
It's more efficient than popen3 and provides meaningful process hierarchies because it performs a single fork/exec. (popen3 double forks to avoid needing to collect the exit status and also calls Process::detach which creates a Ruby Thread!!!!).
It handles all max pipe buffer (PIPE_BUF) hang cases when reading and writing semi-large amounts of data. This is non-trivial to implement correctly and must be accounted for with popen3, spawn, or hand rolled fork/exec code.
It's more portable than hand rolled pipe, fork, exec code because fork(2) and exec aren't available on all platforms. In those cases, POSIX::Spawn::Child falls back to using whatever janky substitutes the platform provides.
The text was updated successfully, but these errors were encountered:
Hi - looks interesting, though I'd be reluctant to because I want to keep dependencies to a minimum.
Was there a specific case where it made a big difference or where popen3 was being problematic? I don't mind popen3 being slightly less efficient if it's not the bottleneck
Another popular image processing library - minimagick, has a plug-in support for it, the dependency being optional. Difference can be huge when dealing with thousands of images.
Would it be possible to use posix-spawn for shell commands?
The text was updated successfully, but these errors were encountered: