-
-
Notifications
You must be signed in to change notification settings - Fork 537
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
Addition of core:os2/process
api.
#3310
base: master
Are you sure you want to change the base?
Conversation
The I'm considering python's |
There also needs to be a way to query file descriptors for process's current streams. The API will probably again end up like in Python. I should look at some other programming languages how they do it. |
…rocess is declared, make easy API for shell processes
An ideal API for starting processes would be to just take argv array, since it allows to avoid the pain of quoting the command line arguments on per-platform basis. This is probably worse on windows, since the quoting behavior is a bit complicated and potentially non-trivial. I'll leave the link here, since I'll probably need it later. |
Also just for windows you'll probably want to use anonymous pipes which through the win32 api cannot be made to do overlapped IO. But you can totally just implement it yourself. A good reference is here: https://stackoverflow.com/questions/60645/overlapped-i-o-on-anonymous-pipe |
core:process
api.core:os2/process
api.
On U*IX systems, please provide a method to allow the caller execute arbitrary code in the child between the fork and exec (mostly so I can call prctl a bunch in the child). |
That's going to be a bit complicated to integrate into such an API that makes sense on multiple platforms. I'll see if I can make the unix version split into two functions to control the starting of the process. |
Also can someone look at why |
Think this is an issue with the CI worker being flaky. |
Add a suitably function pointer to My main use case is to be able to PR_SET_PDEATHSIG so that the OS handles auto-SIGTERMing the child when the parent dies. But having a boolean for that specific Linux-ism is even less ideal than "a function that gets called in the child-side after fork()", since that is potentially useful on every target that does fork + exec... |
It is an actual bug I am able to reproduce locally, not caused here though |
Having platform-specific extensions to |
Currently working slightly on the linux part of the API, and I think I've ran into some issues. So in my current view of how the API should work like, you create the process by using The issue revolves around suspending the process before running and returning the not found error, in case when the file to run wasn't found. Ideally this error should be returned by the I could do checks in Which leads me to believe the issue here is the way I'm chosing to suspend the process. My idea was that upon creation child acquires a locking primitive or listens on a pipe until parent decides to wake it up, then it runs execve. This isn't a repeatable way to do suspend/resume on a process, so maybe installing a signal handler that does the wait on parent is a better idea? Then I wonder whether it's possible to install a signal handler in the Of course another solution is to not provide "start suspended" API, if it cannot be implemented on linux in a sufficiently good way. Or introduce |
This is a work-in-progress draft for the
core:os2/process
api. The goal is to provide an API to Odin for creating and running child processes and provide more things one might want from the API than libc provides.Among some of the features planned:
system()
libc call)In the scope of this PR I will only implement the functionality for Windows and Linux, hopefully darwin won't be that different in terms of possible API interface.