[Gambas-user] 'su -c command' inside Gambas, how do I?

Stefano Palmeri rospolosco at ...152...
Fri Mar 20 13:16:13 CET 2009


Il venerdì 20 marzo 2009 12:48:10 Benoît Minisini ha scritto:
> > Stefano Palmeri ha scritto:
> > > Hi, Benoit. Hi all.
> > >
> > > I've a little problem here. I can't feed the root password
> > > to a "su -c" process invocation. I've attached a little example.
> > > In a form there's a textbox. You type the root password,
> > > then you press 'Confirm' and you should be able to execute
> > > su -c 'cat /etc/sudoers'. But I can't.
> > > Any help appreciated. Thanks.
> >
> > Try using "FOR INPUT OUTPUT" instead of "FOR READ WRITE".
> >
> > There has been some time ago a discussion on this forum about this
> > difference. READ+WRITE is buffered, while INPUT+OUTPUT is not; perhaps,
> > what happens is that you write on process stdin, but data never reaches
> > it because it waits to fill up its buffer. Using INPUT OUTPUT should not
> > try to fill the buffer, but pass the data as soon as it arrives.
> > See the docs for (few) more details.
> >
> > Regards,
> > Doriano.
>
> This is explained in the documentation: for the SHELL and EXEC
> instructions, using INPUT/OUTPUT instead of READ/WRITE runs the process
> inside a unix virtual terminal, which is needed by commands that ask for a
> password.
>
> Regards,

Thanks Benoit, thanks Doriano (strictly a-z ordered :-) ). It works and
I feel deeply stupid :-) , fortunately I'm not a professional programmer :-)

Saluti,

Stefano 




More information about the User mailing list