Use stdin from CLI launch to send console commands
Moderator: GZDoom Developers
-
- Posts: 8
- Joined: Mon Jul 20, 2020 3:10 pm
Use stdin from CLI launch to send console commands
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.
-
-
- Posts: 3819
- Joined: Sun Aug 07, 2011 4:32 am
Re: Use stdin from CLI launch to send console commands
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.
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.
-
- Lead GZDoom+Raze Developer
- Posts: 49204
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Use stdin from CLI launch to send console commands
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.
-
- Posts: 8
- Joined: Mon Jul 20, 2020 3:10 pm
Re: Use stdin from CLI launch to send console commands
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._mental_ wrote:If you need interprocess communication with GZDoom then it should be cross-platform and more explicit than reading from stdin.
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.Most of users run Windows, but GZDoom doesn’t output anything to command prompt window. So, consistency is a wrong premise here as well.
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.
-
-
- Posts: 3819
- Joined: Sun Aug 07, 2011 4:32 am
Re: Use stdin from CLI launch to send console commands
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.