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
nnsee opened this issue Jan 3, 2020 · 4 comments · Fixed by #88041
Closed

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

nnsee opened this issue Jan 3, 2020 · 4 comments · Fixed by #88041
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality verified Verification succeeded
Milestone

Comments

@nnsee
Copy link
Contributor

nnsee 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
Copy link

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.

@nnsee
Copy link
Contributor Author

nnsee 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.

@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Jan 6, 2020
@weinand weinand added this to the January 2020 milestone Jan 6, 2020
@weinand weinand modified the milestones: January 2020, February 2020 Jan 27, 2020
@weinand weinand added feature-request Request for new features or functionality verification-needed Verification of issue is requested labels Feb 24, 2020
@connor4312 connor4312 added verified Verification succeeded and removed verification-needed Verification of issue is requested labels Feb 26, 2020
@connor4312
Copy link
Member

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

image

@weinand
Copy link
Contributor

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 Verification succeeded and removed verification-found Issue verification failed labels Feb 27, 2020
@weinand weinand closed this as completed Feb 27, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants