Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not pollute shell history with automatically executed debugger commands #88038

Closed
neonsea opened this issue Jan 3, 2020 · 4 comments
Closed

Do not pollute shell history with automatically executed debugger commands #88038

neonsea opened this issue Jan 3, 2020 · 4 comments

Comments

@neonsea
Copy link
Contributor

@neonsea neonsea commented Jan 3, 2020

Currently, when a debugger is executed (ie by hitting F5), a terminal is opened and the debugger is executed as a command.

This command can get pretty long as it also changes to the working directory and sets some environment variables. Running the Python debugger in a simple project with only one file runs a command which is 243 characters long.

This, however, means that these commands which are not meant to be run by the user but are instead run automatically are still included in the user's shell history file by default.

I propose changing the command generation function prepareCommand() to include a space at the very beginning - on many shells across various distros, $HISTCONTROL is set to not add commands to history if they start with a space character. This also gives some control to the user whether they'd like for the debugger commands to be stored in history or not.

@B0sh

This comment has been minimized.

Copy link

@B0sh B0sh commented Jan 3, 2020

If you were wondering why someone might want this, I like that the history is there. All the time I go to my command line and use up arrow enter to rerun the last auto generated command. I've also gone through the history a bunch to rerun previous auto generated commands too.

@neonsea

This comment has been minimized.

Copy link
Contributor Author

@neonsea neonsea commented Jan 3, 2020

Aye, this is why I opted for simply adding a space instead of something more aggressive such as unset $HISTFILE - the shell is still in control whether to preserve history or not with $HISTCONTROL.

EDIT: Also, in my shell, commands which were run with a space can still be reached by pressing the up key in the active session, but I'm not sure this is the case in other shells.

@connor4312

This comment has been minimized.

Copy link
Member

@connor4312 connor4312 commented Feb 26, 2020

This works for the integrated terminal, but I noticed the external terminal doesn't get the space on OSX

image

@weinand

This comment has been minimized.

Copy link
Member

@weinand weinand commented Feb 27, 2020

On MacOS the leading space character seems to get dropped in the Applescript that talks to the Terminal application. So the feature at hand only works for the integrated terminal for now.

I've created a new feature request for the external terminal.

Since @connor4312 has verified that the fix works for the integrated terminal, I'm adding the "verified" label.

@weinand weinand added verified and removed verification-found labels Feb 27, 2020
@weinand weinand closed this Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.