Skip to content
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

Create new functions for setting handle inheritable flag #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dustymabe
Copy link

@dustymabe dustymabe commented Aug 9, 2016

I've found a case where it would be useful to mark windows file handles as inheritable or not inheritable in a process. In win32-process the SetHandleInformation function is a private function and is not supposed to be accessed outside of the class. It would be generally useful to have this functionality exposed so that users of win32-process could set this information on file handles.

Here is a commit where I accessed the private methods of the win32-process module in order to achieve the desired effect: dustymabe/vagrant-sshfs@6f285cd

In this commit I expose a few higher level functions that will allow users to easily set the inheritable flag for a handle. You can see how one would use these functions in the following commit which is the diff I would make to the code to go from my previous (hacky) implementation to the new one: dustymabe/vagrant-sshfs@78e942d

Would it be reasonable to expose these functions to the users?

@djberg96
Copy link
Collaborator

djberg96 commented Aug 9, 2016

Let me think about this. My initial reaction is that this should go into win32-file if anywhere.

@dustymabe
Copy link
Author

Let me think about this. My initial reaction is that this should go into win32-file if anywhere.

Thanks!

I didn't know about win32-file before. I was just following what was already being done in win32-process to set the filehandles to be inheritable. In the case of win32-file, would win32-file have this functionality and then in the future win32-process would depend on win32-file in order to use it?

@djberg96
Copy link
Collaborator

@dustymabe That's the preliminary idea. I'll probably let this stew for a bit, though.

@dustymabe
Copy link
Author

hey @djberg96 any update?

@djberg96
Copy link
Collaborator

@dustymabe None, I'm afraid. I've actually been looking for people to take over maintenance of my win32* libraries because I just don't need them any more, and I haven't been dedicating the time that I should to them.

@dustymabe
Copy link
Author

Thanks for the candid response. I wish ruby itself would pick up proper support for this in the language so it wasn't required for it to be maintained outside of the main packages. I have a solution that works so don't worry about this for now.

@djberg96
Copy link
Collaborator

@dustymabe just a quick update that the chef folks are now maintaining the win32 stuff.

@dustymabe
Copy link
Author

thanks! are they keeping it in this repo?

@djberg96
Copy link
Collaborator

@dustymabe Yep, this is the right place.

@sean-simmons-progress
Copy link

@tpowell-progress @dustymabe ~ do you still need this?

@dustymabe
Copy link
Author

@tpowell-progress @dustymabe ~ do you still need this?

It's been a while, but I think it would still be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants