meejah / txtorcon

Twisted-based asynchronous Tor control protocol implementation. Includes unit-tests, examples, state-tracking code and configuration abstraction.
http://fjblvrw2jrxnhtg67qpbzi45r7ofojaoo3orzykesly2j3c2m3htapid.onion/
MIT License
250 stars 72 forks source link

Improve support for getting stderr and stdout output of tor #79

Closed hellais closed 10 years ago

hellais commented 10 years ago

Currently it is not simple to obtain the stdout and stderr output of tor when invoking it via launch_tor. This is because if tor does not reach 100% bootstrap then the deferred returned by launch_tor() does not fire and it is not possible to access the TorProcessProtocol.

It would be very useful to have a way of logging all stdout and stderr output even if no errback is triggered.

meejah commented 10 years ago

@hellais see branch issue-79 that I just pushed; will this work for your use-case?

Basically you just pass something with a .write() to stderr and/or stdout kwargs to launch_tor(). I also made the "kill tor on any stderr output" behavior optional.

hellais commented 10 years ago

@meejah yes this is perfect. It works very well for my use case. Thanks for the prompt reply :)

meejah commented 10 years ago

This is in master now. Will be in next release.