[Gambas-user] Running programs from terminal and by double clicking.

Benoît Minisini gambas at ...1...
Mon Jan 2 20:01:46 CET 2012


Le 02/01/2012 19:24, Jussi Lahtinen a écrit :
> Hi!
> Strange problem. For some reason I'm not able to start child processes if
> the parent program is launched by double clicking.
> This is very specific issue. Firstly child program must be made with
> gambas, and it must be evoked with certain command.
>
> Here is code (also ready project is attached) to test the problem:
>
> Private hProcess As Process
>
> Public Sub Button1_Click()
>
>    Dim sTmp As String = Application.Path&/ "ExecBug2.gambas"
>
>    If Exist(sTmp) = False Then Error.Raise("Binary file is missing!")
>
>    hProcess = Exec ["gbr3", sTmp] For Input As "Process"
>
>    Wait 1
>
>    If hProcess.State = hProcess.Running Then
>      Message("Project is started from terminal!")
>    Else
>      Message("Project is started by double clicking with mouse!")
>    Endif
>
> End
>
>
> Steps to reproduce the problem:
>
> 1. Open the code in IDE and compile two different executables from it, name
> them ExecBug.gambas and ExecBug2.gambas.
> 2. Make sure the executables are in same folder!
> 3. Double click on ExecBug.gambas and read the message; it should tell you
> how you started ExecBug.gambas.
> 4. Open terminal to the folder and type "./ExecBug.gambas".
> 5  Now you should have two instances of this program (ExecBug.gambas and
> ExecBug2.gambas) and message should tell you it is started from terminal.
>
>
> This is new behaviour, but I don't know when this exactly emerged. I would
> say month ago everything worked.
> Am I missing something? Problem with my machine?
>
> Can someone confirm?
> Thanks!
>
> Jussi
>
> Gambas 3 @ Ubuntu 11.10 64bit
>

Exec ["gbr3" ... ] will search for gbr3 in the PATH environment 
variable. Maybe you don't have the same PATH when you run a command from 
a terminal, and when you run it by "double-clicking" on an icon? Note 
that if PATH is not defined, the program is searched in /usr and /usr/bin.

Regards,

-- 
Benoît Minisini




More information about the User mailing list