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
I was working on a module that abstracts out the annoying parts of dealing with PTYs (namely creating them and spawning child processes using them) when I found that it was impossible to write as a subclass of IO::Handle because creating instances of IO::Handle using a file descriptor isn't possible to do. Since IO::Handle's only way of opening files currently takes a path, the only way IO::Handle could be used with PTYs is to get the file name of the master file descriptor and use that, but how this can be done and whether or not it's even possible varies from platform to platform, making it difficult to write portably. While I can create an IO::Handle instance for the slave's file descriptor (since ptsname allows you to get its path), I can't duplicate it and use the new file descriptor with another IO::Handle instance so it can be bound to a Proc::Async instance's stdin/stdout/stderr because, again, IO::Handle instances can't be created using file descriptors.
If wrapping IO::Handle like this with NativeCall is sane, since I imagine this isn't the only case where one would want to be able do this, should it be possible to create IO::Handle instances using file descriptors?
The text was updated successfully, but these errors were encountered:
I was working on a module that abstracts out the annoying parts of dealing with PTYs (namely creating them and spawning child processes using them) when I found that it was impossible to write as a subclass of
IO::Handlebecause creating instances ofIO::Handleusing a file descriptor isn't possible to do. SinceIO::Handle's only way of opening files currently takes a path, the only wayIO::Handlecould be used with PTYs is to get the file name of the master file descriptor and use that, but how this can be done and whether or not it's even possible varies from platform to platform, making it difficult to write portably. While I can create anIO::Handleinstance for the slave's file descriptor (sinceptsnameallows you to get its path), I can't duplicate it and use the new file descriptor with anotherIO::Handleinstance so it can be bound to aProc::Asyncinstance's stdin/stdout/stderr because, again,IO::Handleinstances can't be created using file descriptors.If wrapping
IO::Handlelike this with NativeCall is sane, since I imagine this isn't the only case where one would want to be able do this, should it be possible to createIO::Handleinstances using file descriptors?The text was updated successfully, but these errors were encountered: