question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Terminal doesn't use custom bash profile when debugging

See original GitHub issue

redirected here from closed issue https://github.com/microsoft/vscode/issues/80434 The bug appeared after one of few last updates. When integrated terminal starts it uses custom profile (as expected), but after python script is started it loads profile from ~/.bashrc

In my settings.json I have the following settings:

"terminal.integrated.shellArgs.osx": [
   "--rcfile", "/Volumes/DISK/projs/TechStuff/settings/profile"
],
"terminal.integrated.env.osx": {"HISTFILE":"/dev/null"},
"terminal.integrated.setLocaleVariables": false,

Environment data

Version: 1.38.0 Commit: 3db7e09f3b61f915d03bbfa58e258d6eee843f35 Date: 2019-09-03T21:47:00.464Z Electron: 4.2.10 Chrome: 69.0.3497.128 Node.js: 10.11.0 V8: 6.9.427.31-electron.0 OS: Darwin x64 17.7.0

Expected behaviour

using custom profile (environment)

Actual behaviour

using standard profile (environment), after starting python script

Steps to reproduce:

  1. Assign custom profile to integrated terminal settings.(and restart maybe)
  2. Open page(tab) with any python script and open integrated terminal. (You can put string like echo ‘bashrc loaded’ in profile file to see it loads)
  3. Check profile - it is cutom.
  4. Debug python script (F5 or Debug -> Start Debugging) - it loads bashrc profile instead of custom
  5. Check which profile is loaded (can use printenv command if you set different env. variables or check echo print as mentioned above) - standard profile loaded.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:9
  • Comments:11

github_iconTop GitHub Comments

2reactions
ajodfajcommented, Oct 30, 2019

I have the same issue on win10. I find the debug terminal does not load the arguments given in terminal.integrated.shellArgs.windows, while the terminal launched with ctrl+` load them.

For example, my settings.json is given as

{
    ...
    "terminal.integrated.shell.windows": "D:\\Program Files\\Git\\bin\\bash.exe",
    "terminal.integrated.shellArgs.windows": ["-l", "-i"]
    ...
}

When launched with ctrl+`, the terminal is a login shell (“-l” works), and loads the profile. When debugging, the arguments “-l” and “-i” are missing.

My “hacky” solution is to manually source the profile in ~/.bashrc

source "/d/Program Files/Git/etc/profile"
0reactions
Jenn500commented, Feb 8, 2022

is this issue resolved? I’m encountering the same issue on Windows when trying to debug remotely on Linux. this issue is very important for debugging.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bashrc cannot be sourced, how can I debug? [closed]
I eventually found an answer to this question here: Any command in my terminal that exits with non-zero code closes my terminal window....
Read more >
Fix for .bashrc not executing on startup in Ubuntu on Windows ...
Tip: The source command reads and executes the commands within a file, so would certainly load the ~\. bashrc file, and set the...
Read more >
bash - VSCode Integrated Terminal Doesn't Load .bashrc or ...
I was having a problem that it was loading bash_profile instead of bashrc. Deleting the bash_profile file fixed it. – madprops. Mar 19,...
Read more >
bash.bashrc not working for all users - Ask Ubuntu
Consider temporarily adding [[ -f /tmp/bash.bashrc.debug ]] && echo "$USER in bash.bashrc" just before your alias . Then, through touch and ...
Read more >
Terminal not sourcing ~/.bash_profile
I solved this by setting the value /bin/bash --login in setting->Tools->Terminal->Shell path. /bin/bash --login forces the bash to read the ~/ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found