If you have a look at the pysys-examples, PySys_internal_023, there is an example of doing this;
self.hprocess = self.startProcess(command=sys.executable,
arguments = [script, "3"],
environs = os.environ,
workingDir = self.output,
stdout = "%s/reader.out" % self.output,
stderr = "%s/reader.err" % self.output,
state=BACKGROUND)
# write to the process stdin
self.log.info("Writing to the process stdin")
self.hprocess.write("The cat sat on the mat\n")
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sybase ESP applications can be managed by using the an admin tool as follows. All commands to be executed can be written in a text file and can be given to that tool as follows. Then it executes commands one by one.
esp_cluster_admin < installApp.txt
As stdin parameter is not available for startprocess, it is achieved by using the subprocess.popen as follows. It has stdin parameter.
Hi - the ProcessWrapper object returned by startProcess() has a write method that allows you to write to it's stdin. Is this not what you need?
If you have a look at the pysys-examples, PySys_internal_023, there is an example of doing this;
The requirement here is as follows.
Sybase ESP applications can be managed by using the an admin tool as follows. All commands to be executed can be written in a text file and can be given to that tool as follows. Then it executes commands one by one.
esp_cluster_admin < installApp.txt
As stdin parameter is not available for startprocess, it is achieved by using the subprocess.popen as follows. It has stdin parameter.
fd_in = open('installApp.txt','r')
subprocess.Popen(args=[self.sbadminToolPath,stdin=fd_in,.....)
Last edit: Moray Grieve 2013-05-10
I understand that you might want something more advanced in terms of pipes so this is a valid request, but you can achieve this already, i.e.
hprocess = self.startProcess(...)
fp = open('installApp.txt', 'r')
for line in fp.readlines():
hprocess.write(line)