[Gambas-user] 'su -c command' inside Gambas, how do I?
Doriano Blengino
doriano.blengino at ...1909...
Fri Mar 20 12:41:48 CET 2009
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.
More information about the User
mailing list