[Gambas-user] Strange problem with running Shell on Fedora (code works in IDE but not in executable!!)

Willy Raets willy at ...2734...
Wed Mar 27 18:25:02 CET 2013


On Wed, 2013-03-27 at 17:22 +0100, Tobias Boege wrote:
> Well, there are some vague assumptions I could make about what's going on
> but none of them would be based on knowledge.
> 
> So I just propose something: leave the "echo" out of your command string.
> Instead connect sudo's stdin to your Gambas program directly and write the
> password you obtained as
> 
> Print #hProcess1, sPassword
> 
> immediately after your "Shell" instruction (note that you must open the
> process "For Read Write" now). _Perhaps_ it would even give a better feeling
> to sudo when you use "For Input Output" instead of "Read Write"...
> 
> Maybe you should add Process1_Error() just in case there is something that
> could help you.

Hi Tobias,

Thanks for your answer and you are right. 
I did implement a Catch but that won't feed me back errors in the
process. So I started by adding a Process1_Error handle and now in IDE
all still runs producing a small difference in output.
It now outputs exactly the same as when I copy/paste the sFull output
printed in console to a terminal window and hit enter (1 extra line
saying: error:nothing to do

When run from executable I now get something returned from the process
error handle.

Seems not yum but sudo is complaining:
'sudo: sorry, you must have a tty to run sudo'

tty I understand as terminal. So apparently when run from executable
shell seems to act different somehow. I can't quite wrap my head around
it.

I will have a look at your suggestion on sending the password using read
write or input output.
Could you explain the 'Instead connect sudo's stdin to your Gambas
program directly' a bit more maybe?

Thanks..

-- 
Kind regards,

Willy (aka gbWilly)

http://gambasshowcase.org/
http://howtogambas.org
http://gambos.org



-------------- next part --------------
A non-text attachment was scrubbed...
Name: RunFromExecutable-3.png
Type: image/png
Size: 12379 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20130327/8b788325/attachment.png>


More information about the User mailing list