[Twisted-Python] getProcessOutput - Can it be made to return 'output' instead of differed
orsenthil at gmail.com
Tue Sep 28 06:16:47 EDT 2010
My current application structure is like this:
d = defertoThread(func1,params1)
d = defertoThread(func2, params2)
d.addCallback(lambda r: transport.write(r)
I had designed it this way because, the functions, func1, func2 etc..
were all assumed to be Blocking ones.
One of them, internally uses subprocess.Popen() and executes the
command and returns the output. All is fine till now.
But I had situation, where for the process which is executed via
subprocess module, I had to attach a pseudo-terminal.
subprocess does not have a mechanism to send a pseudo-terminal to the process.
So, I looked into utils.getProcessOutput and found that it does have a
mechanism to send a psuedo-terminal to the process.
But the problem I am facing is, if I replace the subprocess Call in
one of those functions (which are called via deferToThread ), I might
need to return the value (in a blocking way) so that it fits in rest
of the program well.
So, my question is, how can I make utils.getProcessOutput return value
instead of a differed. I am okay if it blocks.
Please let me know if you have any other suggestions. (I am still a
More information about the Twisted-Python