[Gambas-user] who to detect if are running inside IDE

Tobias Boege taboege at ...626...
Mon Jul 3 20:40:46 CEST 2017


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

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list