# How to execute commands using another program, in web Emscripten version? \`stdin\`?

**URL:** <https://discourse.ioquake.org/t/how-to-execute-commands-using-another-program-in-web-emscripten-version-stdin/2046>\
**Category:** dev\
**Created:** [May 31, 2025, 1:16pm UTC](https://discourse.ioquake.org/t/how-to-execute-commands-using-another-program-in-web-emscripten-version-stdin/2046 "2025-05-31T13:16:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![WofWca](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.ioquake.org/wofwca/32/795_2.png) [@WofWca](https://discourse.ioquake.org/u/WofWca)\
**Post date:** [May 31, 2025, 1:16pm UTC](https://discourse.ioquake.org/t/how-to-execute-commands-using-another-program-in-web-emscripten-version-stdin/2046/1 "2025-05-31T13:16:43Z")

</div>

I know this should be possible to utilize `stdin` on a dedicated server, but can I do this with the web version?

So far I only come up with a workaround of `bind K my_command`, and then `window.dispatchEvent(new KeyboardEvent('keydown', { code: `KeyK` }))`, which is not super nice.

What I want this for is to detect when a player connects to the game, and then kicking all the bots and `map_restart`.  
I need it for this project: [GitHub - WofWca/quake3.xdc: A webxdc (in-chat mini-app) version of Quake III Arena](https://github.com/WofWca/quake3.xdc).

---

<div class="post-metadata">

**Author:** ![WofWca](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.ioquake.org/wofwca/32/795_2.png) [@WofWca](https://discourse.ioquake.org/u/WofWca)\
**Post date:** [June 2, 2025, 6:35pm UTC](https://discourse.ioquake.org/t/how-to-execute-commands-using-another-program-in-web-emscripten-version-stdin/2046/2 "2025-06-02T18:35:11Z")

</div>

Regarding the task at hand: I somewhat solved it by adding `set bot_minplayers 2` to `autoexec.cfg`.

But it would still be nice to know the answer to the question.

---

<div class="post-metadata">

**Author:** ![WofWca](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.ioquake.org/wofwca/32/795_2.png) [@WofWca](https://discourse.ioquake.org/u/WofWca)\
**Post date:** [April 24, 2026, 3:11pm UTC](https://discourse.ioquake.org/t/how-to-execute-commands-using-another-program-in-web-emscripten-version-stdin/2046/3 "2026-04-24T15:11:27Z")

</div>

OK I found out that on Linux the normal non-dedicated-server game executable takes stdin by default. It prints “started tty console” when that’s the case. And the responsible code is in [`con_tty.c`](https://github.com/ioquake/ioq3/blob/5956299e80b29ef3891bcec8e99cd3e680f34b1a/code/sys/con_tty.c). I believe that’s what I ought to go after.
