Note that there are some explanatory texts on larger screens.

plurals
  1. POTwisted Python + spawnProcess. Getting output from a command
    primarykey
    data
    text
    <p>I'm working to wrap the Minecraft server application with a Twisted Python server that has a RESTful API for getting the list of currently connected players. The Twisted app starts the minecraft server via <a href="https://github.com/gtaylor/zombiepygman/blob/master/zombiepygman/notchian_wrapper/process.py#L9" rel="nofollow">reactor.spawnProcess()</a>, then communicates via a <a href="https://github.com/gtaylor/zombiepygman/blob/master/zombiepygman/web_api/views.py#L23" rel="nofollow">ProcessTransport</a>, which writes to stdin. Reading stdout and stdin is handled by a separate <a href="https://github.com/gtaylor/zombiepygman/blob/master/zombiepygman/notchian_wrapper/protocol.py" rel="nofollow">protocol.ProcessProtocol</a> class.</p> <p>Given that I want to get the results of a very specific command (the 'list' command, which returns something like this:</p> <pre><code>[INFO] Connected players: blah, blah2 </code></pre> <p>If I am able to pick out a player list line in stdout, what is the best way to deliver this to the RESTful API view that is asking for a list of connected players? Keep in mind that my <a href="https://github.com/gtaylor/zombiepygman/blob/master/zombiepygman/notchian_wrapper/protocol.py" rel="nofollow">stdout reader</a> can not directly communicate with the <a href="https://github.com/gtaylor/zombiepygman/blob/master/zombiepygman/web_api/views.py#L18" rel="nofollow">function that is trying to get the list of connected players</a>. I can parse stdout and identify the player list for delivery, I'm just not sure how to deliver it to the Web API view that will send the connected player list to a client, since the view and the stdout reader aren't in direct contact.</p> <p>I've got a few hacky possible ways to handle this, but would much rather do this the "right way" if anyone has ideas.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload