Chromeless: Read result of child process

52 views
Skip to first unread message

Julian Viereck

unread,
Jun 1, 2011, 10:08:24 AM6/1/11
to mozilla-labs
Hi,

playing around with child process in Chromeless, this is now easier
thanks to Lloyed's example as you can see in [1].

In my usecase, I need to read the output of the child process. Reading
the output once the child process is terminated is enough here, so no
piping/streams required. The child_process.js file has stdin, stdout,
stderr, but these are not bound to the process at all.

Reading the MDC pages about the nsIProcess object [2], I can't see how
to get the output from the process :/ Is there a way to do this?

[1]: https://github.com/mozilla/chromeless/blob/0a7afc64c22333b18d1a33b5650745ed24a6da4e/modules/lib/child_process.js
[2]: https://developer.mozilla.org/en/nsIProcess

Lloyd Hilaiel

unread,
Jun 1, 2011, 11:45:35 AM6/1/11
to mozill...@googlegroups.com
On Jun 1, 2011, at 8:08 AM, Julian Viereck wrote:

> Hi,
>
> playing around with child process in Chromeless, this is now easier
> thanks to Lloyed's example as you can see in [1].
>
> In my usecase, I need to read the output of the child process. Reading
> the output once the child process is terminated is enough here, so no
> piping/streams required. The child_process.js file has stdin, stdout,
> stderr, but these are not bound to the process at all.
>
> Reading the MDC pages about the nsIProcess object [2], I can't see how
> to get the output from the process :/ Is there a way to do this?


No, I don't think it is possible with that API. And as you've discovered, child_process.js has non-implemented stub code which suggests it has features that it does not.

In order for child_process to be more interesting we either need to wait for improvements to land in gecko (there are some open bugs around this that are about four years old), or use jsctypes and include a little bit of native code.

Anything you discover in this area is interesting to me, there's several chromeless issues already open about child processes.

lloyd

> --
> You received this message because you are subscribed to the Google Groups "mozilla-labs" group.
> To post to this group, send email to mozill...@googlegroups.com.
> To unsubscribe from this group, send email to mozilla-labs...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mozilla-labs?hl=en.
>

Dietrich Ayala

unread,
Jun 1, 2011, 11:53:46 AM6/1/11
to mozill...@googlegroups.com
Another option is to bundle the IPC libs with Chromeless:

https://bugzilla.mozilla.org/show_bug.cgi?id=68702#c242

Lloyd Hilaiel

unread,
Jun 1, 2011, 12:27:39 PM6/1/11
to mozill...@googlegroups.com
On Jun 1, 2011, at 9:53 AM, Dietrich Ayala wrote:

> Another option is to bundle the IPC libs with Chromeless:
>
> https://bugzilla.mozilla.org/show_bug.cgi?id=68702#c242

That looks like the best option yet, thanks Dietrich!

lloyd

Irakli Gozalishvili

unread,
Jun 1, 2011, 12:30:40 PM6/1/11
to mozill...@googlegroups.com
Alex have from jetpack team have done some work on that front by porting enigmails IPC. I think using it in chromeless should be pretty easy!
Regards
--
Irakli Gozalishvili
Web: http://www.jeditoolkit.com/
Address: 29 Rue Saint-Georges, 75009 Paris, France

megenius

unread,
Jun 2, 2011, 10:57:34 AM6/2/11
to mozilla-labs
i think that the best option is changing the way child_process is
working.
for example we can create a C library which is then embedded in
chromeless source, & make child_process functions uses the C library
functions to run a process & read/write to the stream. & at the time
of building the C library will be built with the application also, so
we will get a working child_process module that is accessible throught
the usual JS structure + a crossplatform API for child_process.

On Jun 1, 8:30 pm, Irakli Gozalishvili <rfo...@gmail.com> wrote:
> Alex have from jetpack team have done some work on that front by porting enigmails IPC. I think using it in chromeless should be pretty easy!
> Regards
> --
> Irakli Gozalishvili
> Web:http://www.jeditoolkit.com/
> Address: 29 Rue Saint-Georges, 75009 Paris, France (http://goo.gl/maps/3CHu)
>
>
>
>
>
>
>
> On Wednesday, 2011-06-01 at 17:53 , Dietrich Ayala wrote:
> > Another option is to bundle the IPC libs with Chromeless:
>
> >https://bugzilla.mozilla.org/show_bug.cgi?id=68702#c242
>
> >  On Wed, Jun 1, 2011 at 10:45 PM, Lloyd Hilaiel <ll...@hilaiel.com (mailto:ll...@hilaiel.com)> wrote:
> > > On Jun 1, 2011, at 8:08 AM, Julian Viereck wrote:
>
> > > > Hi,
>
> > > > playing around with child process in Chromeless, this is now easier
> > > > thanks to Lloyed's example as you can see in [1].
>
> > > > In my usecase, I need to read the output of the child process. Reading
> > > > the output once the child process is terminated is enough here, so no
> > > > piping/streams required. The child_process.js file has stdin, stdout,
> > > > stderr, but these are not bound to the process at all.
>
> > > > Reading the MDC pages about the nsIProcess object [2], I can't see how
> > > > to get the output from the process :/ Is there a way to do this?
>
> > > No, I don't think it is possible with that API. And as you've discovered, child_process.js has non-implemented stub code which suggests it has features that it does not.
>
> > >  In order for child_process to be more interesting we either need to wait for improvements to land in gecko (there are some open bugs around this that are about four years old), or use jsctypes and include a little bit of native code.
>
> > >  Anything you discover in this area is interesting to me, there's several chromeless issues already open about child processes.
>
> > >  lloyd
>
> > > > [1]:https://github.com/mozilla/chromeless/blob/0a7afc64c22333b18d1a33b565...
> > > > [2]:https://developer.mozilla.org/en/nsIProcess
>
> > > > --
> > > > You received this message because you are subscribed to the Google Groups "mozilla-labs" group.
> > > > To post to this group, send email to mozill...@googlegroups.com (mailto:mozill...@googlegroups.com).
> > > > To unsubscribe from this group, send email to mozilla-labs...@googlegroups.com (mailto:mozilla-labs%2Bunsu...@googlegroups.com).
> > > > For more options, visit this group athttp://groups.google.com/group/mozilla-labs?hl=en.
>
> > >  --
> > >  You received this message because you are subscribed to the Google Groups "mozilla-labs" group.
> > >  To post to this group, send email to mozill...@googlegroups.com (mailto:mozill...@googlegroups.com).
> > >  To unsubscribe from this group, send email to mozilla-labs...@googlegroups.com (mailto:mozilla-labs%2Bunsu...@googlegroups.com).
> > >  For more options, visit this group athttp://groups.google.com/group/mozilla-labs?hl=en.
>
> >  --
> >  You received this message because you are subscribed to the Google Groups "mozilla-labs" group.
> >  To post to this group, send email to mozill...@googlegroups.com (mailto:mozill...@googlegroups.com).
> >  To unsubscribe from this group, send email to mozilla-labs...@googlegroups.com (mailto:mozilla-labs...@googlegroups.com).

Alexandre Poirot

unread,
Jun 9, 2011, 4:27:03 PM6/9/11
to mozilla-labs
Here is my library that ship enigmail IPC component into jetpack:
https://github.com/ochameau/jetpack-subprocess
It may fails because of dynamic libraries being incompatible with last
Firefox version.
(I built this thing way before firefox 4.0 release)
So it may require some binary update from enigmail builds.

Yet another solution could be to write 2 or 3 jsctypes code for each
platform.
I'm pretty sure that it can be done. I took a look at Windows APIs and
it seems to be doable through jsctypes!
Reply all
Reply to author
Forward
0 new messages