-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overwrite all open file descriptors with /dev/null streams #22
Conversation
This also gets rid of STD* streams so we can fully support windows again
Does that work fine on OS X? I think there are portability issues with /proc/self for getting all open FDs IIRC. It also isn't a solution that works on Windows. |
@kelunik I'm open for suggestions for windows and OS X 👍 |
Using |
This doesn't work either: <?php
foreach (new DirectoryIterator('php://fd/*') as $i => $v) {
var_export([$i, $v]);
} Results in:
|
I don't have suggestions, otherwise we would have a solution for Amp already. :-( |
@kelunik would a RFC for something like |
Not sure, I think php://fd is just a mapping. The correct solution would be defaulting every FD to CLOEXEC. |
Hmm ok, but is or isn't there an internal list of internal file descriptors?
Would that be hard or easy to do for |
There's a list of open resources, but not sure whether there's a list of open file descriptors (including inherited ones). As PHP is single threaded, closing all resources on proc_open after forking might be good enough. |
Could you look into that? Mainly interested in getting that list on the parent, so we can
Yeah that is working out really well by doing this: https://github.com/WyriHaximus/reactphp-child-process-messenger/pull/22/files#diff-8157a0d28a58887c0293ce14b4b0281fR83 |
Not sure whether I'll get to that, don't have that much internals knowledge. Maybe @trowski? |
# Conflicts: # composer.json # composer.lock
This also gets rid of STD* streams so we can fully support windows again
Refs reactphp/child-process#65