Use stdin from CLI launch to send console commands

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

User avatar
frozenfoxx
Posts: 8
Joined: Mon Jul 20, 2020 3:10 pm

Use stdin from CLI launch to send console commands

Post by frozenfoxx »

Would it be possible to redirect stdin from the CLI into the in-game console. This would be similar to how, say, Zandronum-server works. All the output from GZDoom console currently gets outputted to the CLI so it would still be consistent, and this would allow wrappers for GZDoom to issue commands into a running game.
_mental_
 
 
Posts: 3791
Joined: Sun Aug 07, 2011 4:32 am

Re: Use stdin from CLI launch to send console commands

Post by _mental_ »

If you need interprocess communication with GZDoom then it should be cross-platform and more explicit than reading from stdin.
Most of users run Windows, but GZDoom doesn’t output anything to command prompt window. So, consistency is a wrong premise here as well.

In general, IPC can be useful for various reasons. Although, it should work on three main platforms identically. That's the main problem with its implementation.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48514
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Use stdin from CLI launch to send console commands

Post by Graf Zahl »

In Windows, console output is controlled by a command line option, but the entire thing doesn't actually write to stdout but directly to Windows's console. And that console API is broken beyond repair for Unicode output anyway. Its main reason for existence is being able to see console output in a debug session otherwise I would have removed that code already.
User avatar
frozenfoxx
Posts: 8
Joined: Mon Jul 20, 2020 3:10 pm

Re: Use stdin from CLI launch to send console commands

Post by frozenfoxx »

_mental_ wrote:If you need interprocess communication with GZDoom then it should be cross-platform and more explicit than reading from stdin.
Definitely wouldn't mind this, but I'm unfamiliar with what options would be available to do that with GZDoom. For my own project I'm looking to tell a live session to execute scripts just like I would with the console in-game, only triggered from outside of the game. It's not robust and wouldn't allow you a lot of flexibility, but since the process can already output to the terminal with stdout I thought reading from stdin would be simpler and more likely to be implemented.
Most of users run Windows, but GZDoom doesn’t output anything to command prompt window. So, consistency is a wrong premise here as well.
That is true, my apologies, I had wrongfully assumed that Windows would output the same as it does on MacOS and Linux if you launched it directly.


If this is not a feature that can be implemented, would it be feasible to use ACS or ZScript to dump console output to a file or read input from another file? Most of my experience dealing with ACS is for control through the console since my previous project used Zandronum Server which allows me to hook it this way. If so I can go looking for it but I'm not really sure if that's possible as an alternative.

Thank you for your time on this.
_mental_
 
 
Posts: 3791
Joined: Sun Aug 07, 2011 4:32 am

Re: Use stdin from CLI launch to send console commands

Post by _mental_ »

Writing files from any kind of scripts is considered harmful. Reading files that changes externally is possible via ZScript, although it could be a bad idea depending on how it affects the game.

Return to “Feature Suggestions [GZDoom]”