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

Add 'detached process' option #6

Open
studoot opened this issue Jul 28, 2022 · 3 comments
Open

Add 'detached process' option #6

studoot opened this issue Jul 28, 2022 · 3 comments

Comments

@studoot
Copy link
Contributor

studoot commented Jul 28, 2022

I've recently had need of a detached process on Windows (i.e. it doesn't open a new console window) while using not-enough-standards.

I implemented this by adding a detached flag to process_options and processing it in the Windows implementation of the relevant process constructor (here's the commit in my fork).

This is a feature that I think Winows programmers would find useful and I'm quite happy to create a PR for this. I'm not sure that Linux has an equivalent need (I'm not particularly experienced with Linux, though), in which case detached would be a no-op. If you had other suggestions, please let me know.

@Alairion
Copy link
Owner

Hi studoot,

This may indeed be a useful feature, but I don't think "detached" is a good name for this process option because it will create ambiguity with the detach() function and the whole "join" concept, example:

nes::process proc{..., nes::process_options::detached};
//Do I need to call detach or join ? humm

Since it is not implementable on most other systems ("console app" is a windows only concept afaik), maybe we can add it as an extension and name it "win32_detached" or something that to relieve this ambiguity and clearly mark it as a platform specific feature. And if we do this then give it a higher value to prevent future potential enum conflict, like 0x01 << 24, where 24 could be the "platform-specific shift"

@studoot
Copy link
Contributor Author

studoot commented Aug 13, 2022

Yes, that all sounds good - I'll implement those changes and create the PR.

@SirLynix
Copy link

Qt calls it detached process too "QProcess::spawnDetached", and it also means that the process becomes the leader of its own process group (CREATE_NEW_PROCESS_GROUP on Windows, fork + setsid + posix_spawn on Posix).

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

No branches or pull requests

3 participants