[Gambas-user] Help with SHELL and EXEC

Benoit Minisini gambas at ...1...
Sun Oct 12 13:09:52 CEST 2008


On dimanche 12 octobre 2008, Doriano Blengino wrote:
> Benoit Minisini ha scritto:
> > On dimanche 12 octobre 2008, Doriano Blengino wrote:
> >> Kari Laine ha scritto:
> >>
> >> If you look carefully at the docs about EXEC:
> >>
> >>   [ _Process_ *=* ] *EXEC* _Command_ [ *WAIT* ] [ *FOR* { { *READ* |
> >> *INPUT* } | { *WRITE* | *OUTPUT* } } ] [ *AS* _Name_ ]
> >>
> >> you'll notice that you can't specify both READ & WRITE --------^
> >
> > Guess what: Gambas internally uses -two- pipes. One for reading the
> > process output, and another for writing to it. Of course only one pipe is
> > used if you specify only READ or WRITE.
>
> What I can say is, if you specify READ & WRITE, it simply doesn't work.
> If you specify INPUT & OUTPUT, it works.
> If you specify READ & OUTPUT or INPUT & WRITE, don't know.
> I don't want to go into details because I don't know them - but I think
> that specifying INPUT and/or OUTPUT, then a different approach is taken
> (right: documentation says the process is run inside a virtual
> terminal). But normally a user thinks "I just want to run a filter - why
> should I need a virtual terminal?" So what he gets is the thing fails,
> as happened to Kari.
> I only tried INPUT & OUTPUT because I loosely remembered what that book
> was saying.
>
> I think in the docs a retouch should be done, because (am I right?) they
> make you think that you can not specify a couple of keywords but only
> one at a time (one among READ, INPUT, WRITE, OUTPUT). Sum this up with
> the fact that you have to use a virtual terminal to be able to read and
> write concurrently to another process, and you'll end up to think that
> specifying both READ and WRITE can not work...
>
> >> Then, reading more carefully, I noticed that the docs say: "if you
> >> specify INPUT & OUTPUT instead of READ & WRITE, then the process is
> >> executed inside a virtual terminal". Remembering that that book was
> >> talking, if I well remember, about virtual terminals to be necessary to
> >> do such things, I tried in gambas. And it works!
> >
> > I'm happy to know that. :-)
> >
> :-) I am happy too... this is a very powerful feature. I remember that
>
> the Afterstep window manager used this double pipe to implement applets.
> So simple... you could write window manager applets in bash. And in
> gambas this could be used to carry out heavy works by external programs
> (sorts, image manipulation and many more...).
>
> Regards,
> Doriano
>

Some processes need to be run in a virtual terminal, but most of them don't, 
and you should not have problems with them.

So please be give more details (i.e. some source code!) when you say that 
they "just don't work".

Note that processes that don't need virtual terminals, can be run with them 
without problems. But you are adding a useless heavy layer then!

Regards,

-- 
Benoit Minisini




More information about the User mailing list