[Gambas-user] who to detect if are running inside IDE
Karl Reinl
karl.reinl at ...9...
Mon Jul 3 22:00:26 CEST 2017
Am Montag, den 03.07.2017, 20:40 +0200 schrieb Tobias Boege:
> On Mon, 03 Jul 2017, PICCORO McKAY Lenz wrote:
> > a piece of code to who to detect if are running inside IDE? any ideas how
> > to?
> >
>
> Exact same question here: https://sourceforge.net/p/gambas/mailman/message/34204796/
>
> If I may add something to the things said in the above thread: you could try
> to get the parent PID of your Gambas process and determine if it's the IDE.
>
> If you always run on Linux you can probably use the /proc filesystem to get
> the path to the executable of your parent process or its command line. Then
> it depends on if you want to trust that the user always installs the IDE as
> "gambas3.gambas", for instance. Examining the parent process will probably
> not work anymore if you run your process *from the IDE* but through gb.httpd
> or through xterm (which are options in the IDE).
>
> I'm convinced that no matter how you try to detect if you're run by the IDE
> or not, someone can create an environment where your test gives the wrong
> answer. I still stand by my statement from two years ago: you shouldn't care
> where your program is run from in the first place. What problem are you
> trying to solve by knowing that?
>
> Regards,
> Tobi
>
Salut Tobi,
I use (since gambas1) the project Arguments from the IDE. I set a ISIDE.
Sub chkIfIsIDE()
Dim nI As Integer
bIsIDE = False
For nI = 0 To Application.Args.Count - 1
' PRINT Application.Args[nI]
If InStr(UCase(Application.Args[nI]), "ISIDE") > 0 Then
bIsIDE = True
Endif
Next
End
So if I don't call my project with a parameter called ISIDE, I can be
sure .I ran in the IDE.
And the use is, I set the first key of my DB to 9999 that is my
Test-Mandant that's just a copy from one of my Mandants in my DB.
So no problems with crashing DB-data, that's the problem I solved with!.
Sorry : Mandant = mandator
More information about the User
mailing list