I am trying to find out about a subprocess module and therefore am creating an hlds server administrator.
My goal is to run server instances and send all commands through dispatcher.py to administer multiple servers, for example. send commands to stdin subprocesses.
what I have so far for initial testing, but already stuck:]
import subprocess
RUN = '/home/daniel/hlds/hlds_run -game cstrike -map de_dust2 -maxplayers 11'
hlds = subprocess.Popen(RUN.split(), stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
print hlds.communicate()[0]
print hlds.communicate()[1]
hlds.communicate('quit')
I do not get any output from the hlds server, but it works fine if I do not set stdout to PIPE. And hlds.communicate('quit')it doesn't seem to go to the stdin hlds process. The ls -l command returns stdout correctly, but not hlds.
All help is appreciated! :)
source
share