[Twisted-Python] Re: Improving spawnProcess and friends

Jean-Paul Calderone exarkun at divmod.com
Sun Jul 23 22:01:38 EDT 2006


On Sun, 23 Jul 2006 23:15:49 +0300, Nuutti Kotivuori <naked at iki.fi> wrote:
>Itamar Shtull-Trauring wrote:
>> On Sat, 2006-07-22 at 18:44 +0300, Nuutti Kotivuori wrote:
>>
>> ... adding factory object to process spawning ...
>>
>>> How does this sound? If nobody yells murder, I'll be starting to build
>>> a rudimentary implementation of this to see how the API would
>>> naturally turn out to be and then submit it here for review.
>>
>> Seems... over-engineered. I'm not sure adding a whole new object is the
>> way to go on this.
>
>A valid concern, it did cross my mind as well. However, I have yet to
>think of a better way to achieve all the features that are wished
>for. Any suggestions?
>
>Anyway, I have implemented some of the changes already. The patch is
>again attached to the issue. Everything is still subject to change,
>however. But, this is how setting up a process would look like at the
>moment:
>
>  class MyProcessProtocolFactory(process.ProcessProtocolFactory):
>      def processSetup(self, proc):
>           proc.addHelper(SetuidHelper(1000, 1000))
>           proc.addHelper(ChdirHelper('/tmp'))
>           proc.addHelper(PTY('pty', [0, 1]))
>           proc.addHelper(PassthroughFD(sys.stderr.fileno(), [2]))
>           proc.addHelper(WritePipe('passphrase', [3]))

I think this probably isn't the best API.

Jean-Paul




More information about the Twisted-Python mailing list