Search code examples
xpcomthunderbirdthunderbird-addon

mozilla extension - reading stdout of external process


I am trying to run dvipng process from a thunderbird extension using Components.interfaces.nsIProcess. I need to read standard output of the process, but I am not able to find a way to do that. I found some threads on nsIProcess2, but that one was (as it seems) never fully implemented with stdout. Any suggestions?


Solution

  • nsIProcess2 is unrelated - it was implemented but later folded into nsIProcess. It was only about starting processes asynchronously.

    The relevant bugs are bug 484246 and bug 68702. The latter has been resolved but so far that code doesn't ship with Firefox/Thunderbird by default (it's quite a bit of code that neither Firefox nor Thunderbird need themselves). So your options are:

    • Build IPCModule yourself and make it part of your extension - not recommendable because it will cause lots of troubles.
    • Create a native library that will call dvipng for you, use it via js-ctypes - should be the easiest solution.
    • Turn dvipng into a library and use it directly via js-ctypes - probably not too hard either, this will also give you better performance.