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

Allow getting exit value from a spawned process #9471

Closed
KoBeWi opened this issue Apr 7, 2024 · 0 comments · Fixed by godotengine/godot#90358
Closed

Allow getting exit value from a spawned process #9471

KoBeWi opened this issue Apr 7, 2024 · 0 comments · Fixed by godotengine/godot#90358
Milestone

Comments

@KoBeWi
Copy link
Member

KoBeWi commented Apr 7, 2024

Describe the project you are working on

A secret project I'll share soon 👀

Describe the problem or limitation you are having in your project

I'm using the new pipe API (godotengine/godot#89206) to spawn and read output of a process. The problem is, when the process ends, I don't know what code it returned on exist and there doesn't seem to be any way to check that.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add some function to get exit value of a spawned process (probably based on its PID).

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

OS.execute() can already return exit code, so I think it's possible for OS.start_process() and OS.create_process() and OS.execute_with_pipe(). I think the new method could be OS.get_exit_code(pid) (and we already have OS.is_process_running(pid).

If this enhancement will not be used often, can it be worked around with a few lines of script?

Literally impossible.

Is there a reason why this should be core and not an add-on in the asset library?

It can't without tinkering with C++ OS API.

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

Successfully merging a pull request may close this issue.

2 participants