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

fuck can't configure itself automatically on bash #662

Closed
Googulator opened this issue Jun 27, 2017 · 3 comments
Closed

fuck can't configure itself automatically on bash #662

Googulator opened this issue Jun 27, 2017 · 3 comments

Comments

@Googulator
Copy link

Googulator commented Jun 27, 2017

Executing "fuck" twice on a system with no alias configured simply displays the configuration message twice, rather than auto-configuring on the second run.

The problem appears to be that _is_second_run() always returns False due to shell.get_history() not getting the complete (recent) history. This is because Bash keeps the history from its current session in memory, and only writes it to .bash_history either when it quits or when "history -a" is called.

The obvious fix would be to call "history -a" in the __init__() of class Bash, but I'm not sure if that's enough.

@Googulator
Copy link
Author

Filed pull request #663 with a fix. It's not optimal, unfortunately - we would have to call "history -a" in the context of the Bash process that called "fuck", and we can only do so in a subshell, which doesn't have the intended effect.

@nvbn
Copy link
Owner

nvbn commented Aug 8, 2017

@Googulator sorry for so huge delay. I've tried a bit simpler approach, now it configures alias if the previous fuck was less then 60 seconds ago and from the same shell.

nvbn added a commit that referenced this issue Aug 8, 2017
#662: Autoconfigure when `fuck` was called < 60 seconds ago from the same shell
@nvbn
Copy link
Owner

nvbn commented Aug 16, 2017

Fixed in 3.20

@nvbn nvbn closed this as completed Oct 16, 2017
riley-martine pushed a commit to riley-martine/thefuck that referenced this issue Dec 7, 2023
riley-martine pushed a commit to riley-martine/thefuck that referenced this issue Dec 7, 2023
nvbn#662: Autoconfigure when `fuck` was called < 60 seconds ago from the same shell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants