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.

Avoid adding commands to shell history

See original GitHub issue

https://github.com/microsoft/vscode/issues/85887 is indicating that the Python extension sets the environment of the terminal by using sendText still which has a number of drawbacks including: it’s slower (you might need a timeout), less reliable (you don’t know what the rc script will do), may end up in shell history and it’s ugly as the env command is shown to the user.

This related issue was created in the past but it’s locked https://github.com/microsoft/vscode-python/issues/7041, I believe this discussion belongs in this extension rather than in the VS Code repo. I suggest also unlocking that issue as it’s requesting to prefix the command with a space to avoid it being added to shell history (I can’t seem to get that to work though? set HISTCONTROL to enable this).

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Tyriarcommented, Dec 13, 2022

The current mechanism is definitely flawed, the Python team (which I’m not on) is actively working on improving how environments are activated by leveraging process environment vs running a command.

1reaction
simon04commented, Dec 13, 2022

May I resurface this issue? I’m using fish shell and the history pollution for virtualenv’s venv/bin/activate.fish is very annoying.

One issue is the absolute path used for the source command since a manual subsequent history lookup (aiming for source ./venv/bin/activate.fish) in any project will yield most likely a command issued by vscode-python for a random project.

One issue is that there seems to be a delay between opening a new shell and the source command being issued by vscode-python. It happens casually (under high system load) that I’m opening a shell to issue a git ... command and vscode-python interferes with my typing resulting in some of the garbled commands shown below:

[1] source /home/simon/src/xxx1/venv/bin/activate.fish
[2] gisource /home/simon/xxx2/venv/bin/activate.fish
[3] source /home/simon/xxx3/venv/bin/activate.fish
[4] source /home/simon/xxx4/venv/bin/activate.fish
[5] source ./venv/bin/activate.fish
[6] source /home/simon/xxx5/venv/bin/activate.fish
[7] source /home/simon/xxx6/venv/bin/activate.fish
[8] gsource /home/simon/xxx7/venv/bin/activate.fish
[9] source /home/simon/src/xxx8/venv/bin/activate.fish
[10] bsource /home/simon/xxx9/venv/bin/activate.fish
[11] source /home/simon/src/xxx10/venv/bin/activate.fish
[12] isource /home/simon/xxx11/venv/bin/activate.fish
[13] tsource /home/simon/xxx12/venv/bin/activate.fish
[14] pysource /home/simon/xxx13/venv/bin/activate.fish
[15] gisource /home/simon/xxx14/venv/bin/activate.fish
[16] git source /home/simon/xxx15/venv/bin/activate.fish
Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I prevent commands from showing up in Bash history?
In your .bashrc/.bash_profile/wherever you want, put export HISTIGNORE=' *' . Then just begin any command you want to ignore with one space.
Read more >
Temporarily suspend bash_history on a given shell?
The first and simplest is to use ignorespace (or ignoreboth): $ HISTCONTROL="ignorespace${HISTCONTROL:+:$HISTCONTROL}" · Avoid recording commands ...
Read more >
How to disable bash shell history in Linux - nixCraft
How to permanently disable bash history using set command ... Again add set +o history to the end of to a new /etc/profile.d/disable.history.sh ......
Read more >
How to manage your Linux command history | Enable Sysadmin
In Bash, your command history is stored in a file ( .bash_history ) in your home directory. The leading (.) makes the file...
Read more >
How to Remove/ Disable Bash shell Command History on Linux
1. Disable history for a current shell. # set +o history · 2. Clean command history. # history -c · 3. Permanently disable...
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