[Gambas-user] Strange problem with running Shell on Fedora (code works in IDE but not in executable!!)
Benoît Minisini
gambas at ...1...
Sat Mar 30 13:05:11 CET 2013
Le 30/03/2013 12:11, Tobias Boege a écrit :
> On Sat, 30 Mar 2013, Tobias Boege wrote:
>> Hmm. I have sudo-1.8.6p7 in use (more accurately, the error comes from the
>> 'sudoers' plugin but it has the same version here) on Arch Linux and, as I
>> said, my test program works.
>>
>> Well, I had another look at the source code and it seems that there's a
>> certain variable 'def_requiretty' which is zero in my system's package and
>> prevents checking /dev/tty at all. This finally explains why all test cases
>> worked on my system even though there was no /dev/tty accessible from
>> Desktop. See sudoers(5) for a description and how to deactivate this in the
>> sudoers configuration.
>>
>> Since editing user configurations to make programs work is often not
>> desirable, I experimented with a patched sudo that requires the tty et
>> voila! Got the same error as yours when running from desktop. However, now
>> I can't solve it either :-)
>>
>> I'll start another thread to attract Benoit's attention again...
>>
>
> Hmm, nevermind. You can use the Exec instruction to get it to work:
>
> hProcess = Exec ["sudo", "-s", "id", "-u" ] For Input Output As "Process"
>
> This is how the IDE does it and as you mentioned, the IDE gets it correctly.
> Maybe someone can enlighten us why it doesn't work with Shell but it's not
> that important to me.
>
> Regards,
> Tobi
>
SHELL "a b c" ...
is equivalent to:
EXEC [ System.Shell, "-c", "a b c" ]
with a call to setpgid(0,0) to create its own session like an
independant shell.
As for virtual terminal creation, they work both the same.
- "For Input Output" => create a virtual terminal for the i/o of the
child process, and get the i/o of the child process through it.
- "For Read Write" => Just redirect the i/o of the child process to get
them in the parent process.
Can you try to replace "SHELL ..." by "EXEC [ System.Shell, "-c", ... ]"
and tell me if it works better?
--
Benoît Minisini
More information about the User
mailing list