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

Kernel32.CreateProcess() also for Unix. #1417

Open
Osiris-Team opened this issue Mar 11, 2022 · 2 comments
Open

Kernel32.CreateProcess() also for Unix. #1417

Osiris-Team opened this issue Mar 11, 2022 · 2 comments

Comments

@Osiris-Team
Copy link

Osiris-Team commented Mar 11, 2022

The jna platform jar doesn't seem to include methods for creating processes on unix systems, but it does for windows here.
It would be great to have something similar to that also for unix.
I am a complete noob with native libraries, but I still would like to create a PR for this, so any additional information is very welcome!
It looks like there is a fork() command on unix systems to achieve this.

@matthiasblaesing
Copy link
Member

You are probably looking for https://man7.org/linux/man-pages/man3/posix_spawn.3.html, but why I repost my question: Why not use the JDK? Sure for 7+8 you need to use reflection, but then, you also don't need to know the ugly details of correctly spawning a new process and from 9 on you can access the PID directly and poke the process with posix/win32 APIs.

@Osiris-Team
Copy link
Author

Osiris-Team commented Mar 11, 2022

Thanks for the link, but that method is only available for linux (and its distros) and not all Unix systems, I think.
Yeah, I could use the reflection API, but I think that's kind of nasty, and it's also blocked/not allowed on third-party applications sometimes.
I am working on this: https://github.com/Osiris-Team/jProcesses2 and thus I'm gonna have to create processes manually.

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

No branches or pull requests

2 participants