Describe the project you are working on
A game where we call certain OS commands to get system info for debug purposes.
Describe the problem or limitation you are having in your project
As mentioned above, we execute certain OS commands to obtain hardware info for our game. We then process the standard out, and standard error separately before handling it. However the engine provided OS.execute does not allow us to do this, as stdout and stderr is just combined together.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Allowing us to seperate stdout and stderr would solve these issues.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I'm proposing to change the signature from
int execute (String path, PoolStringArray arguments, bool blocking=true, Array output=[ ], bool read_stderr=false, bool open_console=false)
to
int execute (String path, PoolStringArray arguments, bool blocking=true, Array output=[ ], Array error=[ ], bool open_console=false)
Users that wish to have the previous behaviour of combining the stdout and stderr could provide the same argument into output and error. I understand that this function has a great deal of complexity already, so I'm hoping this proposal would be able to not add yet another argument. I'm not sure if this proposal will be able to maintain backwards compatibility this way, though.
If this enhancement will not be used often, can it be worked around with a few lines of script?
There's some potential OS-specific workarounds involving temporary files and piping things around, but that then introduces some issues with different environments handling things differently. Otherwise can't be fixed by gdscript.
Is there a reason why this should be core and not an add-on in the asset library?
We have a GDNative extension (and in the future a GDExtension) to replace OS.execute for this specific use case. However adding an entire C build dependency for this minor use case is quite annoying, and can introduce instability in our project.
Describe the project you are working on
A game where we call certain OS commands to get system info for debug purposes.
Describe the problem or limitation you are having in your project
As mentioned above, we execute certain OS commands to obtain hardware info for our game. We then process the standard out, and standard error separately before handling it. However the engine provided OS.execute does not allow us to do this, as stdout and stderr is just combined together.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Allowing us to seperate stdout and stderr would solve these issues.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I'm proposing to change the signature from
int execute (String path, PoolStringArray arguments, bool blocking=true, Array output=[ ], bool read_stderr=false, bool open_console=false)to
int execute (String path, PoolStringArray arguments, bool blocking=true, Array output=[ ], Array error=[ ], bool open_console=false)Users that wish to have the previous behaviour of combining the stdout and stderr could provide the same argument into
outputanderror. I understand that this function has a great deal of complexity already, so I'm hoping this proposal would be able to not add yet another argument. I'm not sure if this proposal will be able to maintain backwards compatibility this way, though.If this enhancement will not be used often, can it be worked around with a few lines of script?
There's some potential OS-specific workarounds involving temporary files and piping things around, but that then introduces some issues with different environments handling things differently. Otherwise can't be fixed by gdscript.
Is there a reason why this should be core and not an add-on in the asset library?
We have a GDNative extension (and in the future a GDExtension) to replace OS.execute for this specific use case. However adding an entire C build dependency for this minor use case is quite annoying, and can introduce instability in our project.