Author Topic: launch console programs using gnome-terminal with environment set  (Read 3113 times)

Offline Napoleon

  • Multiple posting newcomer
  • *
  • Posts: 59
In the 'Environment' general settings I have:
"Shell to run commands in" set to
Code: [Select]
/bin/bash -i -c"Terminal to launch console programs" set to
Code: [Select]
gnome-terminal --geometry +1921+0 --disable-factory -x
Compiling my projects, some of which use of custom makefiles, works fine as per the 'Shell' setting above.

However, when I'm debugging my code, the terminal comes up and runs my program, but it doesn't have the environment set up  as per my ~/.bashrc.
The only way I've been able to get the environment variables set up thus far has been by editting /etc/profile.  Which is not really how I want to do it.

Could someone advise how to set the "Terminal" parameter such that it reads ~/.bashrc (or one of the others)?

Cheers,
Nap

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12127
    • Travis build status
Re: launch console programs using gnome-terminal with environment set
« Reply #1 on: October 05, 2014, 12:47:04 pm »
When launching the debugger, C::B doens't launch any shell process so the debugger doesn't see the env vars defined in a shell.
The terminal is launched as a separate process and then gdb uses it as tty.
You can use your favourite process explorer (top, htop, ps) to see how things work.

Probably the most reliable way to set env vars is using the envvar plugin. Settings -> Environment -> Env Var.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Napoleon

  • Multiple posting newcomer
  • *
  • Posts: 59
Re: launch console programs using gnome-terminal with environment set
« Reply #2 on: October 05, 2014, 05:35:54 pm »
@oBFusCATed,  ic.  Thanks.

I've got them in /etc/profile already and its working, so I'll stick with that on this project.