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

[BUG] Brew uninstall command won't execute after uninstall #165

Closed
L1cardo opened this issue Nov 26, 2024 · 14 comments
Closed

[BUG] Brew uninstall command won't execute after uninstall #165

L1cardo opened this issue Nov 26, 2024 · 14 comments

Comments

@L1cardo
Copy link
Contributor

L1cardo commented Nov 26, 2024

If the close after uninstall option is on, the auto brew uninstall command won't execute.
image

Also I have found some other bugs:

  1. CLI support can't be enabled, and here is the error log
    image
    image
  2. close after uninstall says it will only affect when Pearcleaner is opened via Finder extension, but if I open the app normally , it will also close itself after uninstall.
    image
@alienator88
Copy link
Owner

Okay, I think I have all of them fixed on my end except for the CLI one.
When the CLI is enabled, all it does is it creates a symlink to the pearcleaner binary and links it to the /usr/local/bin folder.

So the full command would be:
ln -s '/Applications/Pearcleaner/Contents/MacOS/Pearcleaner' '/usr/local/bin/pearcleaner'

When you recorded the logs, did you enable, disable or both, the CLI toggle?
Can you record toggling it on and off?
When it's successful, the logs should show this:

Symlink created successfully at /usr/local/bin/pearcleaner.
Symlink removed successfully from /usr/local/bin/pearcleaner.

@L1cardo
Copy link
Contributor Author

L1cardo commented Nov 26, 2024

The above picture is when it's on.
The log shows nothing when I turn it off.

@alienator88
Copy link
Owner

I'm guessing you don't have a pearcleaner binary at /usr/local/bin/pearcleaner at the moment?

The error in the screenshot seems to point out that it tried to remove the symlink but it didn't exist:
image

Which it shouldn't do because it runs a check to see if the symlink exists first and only executes it if it exists:

func manageSymlink(install: Bool) {

@L1cardo
Copy link
Contributor Author

L1cardo commented Nov 26, 2024

I don't even have this directory /usr/local/bin/, I only have /usr/local/

And here is the video

2024-11-27.7.54.08.mov

@alienator88
Copy link
Owner

That's kind of wild, I haven't seen anyone without that bin folder before. I thought it was default on macOS.
I bet if you run this in terminal and then try Pearcleaner CLI toggle again, it should work:
sudo mkdir /usr/local/bin

I might need to add a catch and check that the folder exists before running the symlink commands.

@L1cardo
Copy link
Contributor Author

L1cardo commented Nov 27, 2024

That's kind of wild, I haven't seen anyone without that bin folder before. I thought it was default on macOS. I bet if you run this in terminal and then try Pearcleaner CLI toggle again, it should work: sudo mkdir /usr/local/bin

I might need to add a catch and check that the folder exists before running the symlink commands.

Yeah, it worked after sudo mkdir /usr/local/bin

@alienator88
Copy link
Owner

Awesome, thanks for confirming!
I added a check to make sure the folder exists first before trying to symlink it there. That should avoid this issue in the future.
Can you try this test build and see if your other issues are resolved as well?
Pearcleaner.zip

@L1cardo
Copy link
Contributor Author

L1cardo commented Nov 27, 2024

Tried your test build and the latest release build, if I uninstall an app from Finder extension, the brew uninstall command won't trigger.

@alienator88
Copy link
Owner

Ughh..hmm..I just tested it now and it came right up with terminal and brew cleaned the app once I clicked uninstall.
You have brew cleanup setting enabled still?

Maybe record it and show me what you get.

@L1cardo
Copy link
Contributor Author

L1cardo commented Nov 28, 2024

Log shows nothing special

2024-11-28.8.03.43.mov

image

@alienator88
Copy link
Owner

Ahh, it's the close after uninstall setting preventing it still.
It seems there's a race condition, I'll figure it out and push out another update after the holidays.
I want to refactor the uninstall logic and make it cleaner anyways.

@alienator88
Copy link
Owner

Actually, can you try this when you have a moment? I was able to work on it a bit.
Pearcleaner.zip

@L1cardo
Copy link
Contributor Author

L1cardo commented Nov 28, 2024

Yeah, now it works

@alienator88
Copy link
Owner

I'll have this out in the next patch release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants