Skip to content

Conversation

infstate
Copy link
Contributor

@infstate infstate commented Oct 27, 2024

bugfix1
nobug

Type of Change

  • New feature
  • Bug fix
  • Documentation update
  • Refactoring
  • Hotfix
  • Security patch
  • UI/UX improvement

Description

When running the system cleanup option on Arch Linux (pacman), if the user has no orphaned (unused) packages the command will return 1 so the TUI think it failed and aborts. The issue is (pacman -Qtdq). So I added a check which runs it first and if the command executes sucessfully (returns 0) then it will continue with cleanup.

I also added a output if it found any packages and if not it will let the user know it skipped. (see screenshot below)

Testing

I tested this on my Arch with pacman and it works. I also don't have any orphaned pkgs.

Impact

Without this check it will fail and not do the rest of the cleanup (logs, temp files, etc) and just aborts and skips the whole process because the control flow think it fail.

Issues / other PRs related

N/A

Additional Information

If anyone has any unused packages, check it it will detect it.

Checklist

  • My code adheres to the coding and style guidelines of the project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no errors/warnings/merge conflicts.

@adamperkowski
Copy link
Collaborator

No need for all that. Just remove 2>&1.

@infstate
Copy link
Contributor Author

Alright, do you want to send a suggested change so I can approve it? Or I manually do it

@infstate
Copy link
Contributor Author

It would still fail because its the return code of that command. Our TUI backend will abort.
no

@adamperkowski
Copy link
Collaborator

It would still fail because its the return code of that command. Our TUI backend will abort.

I meant still redirecting to /dev/null, just doing || true

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>
@infstate
Copy link
Contributor Author

Alright, looks good its working on my end

@adamperkowski adamperkowski changed the title fix: System cleanup failing because no orphan pkgs fix(system-cleanup): failing with no orphan packages on arch Oct 27, 2024
@adamperkowski adamperkowski added the bug Something isn't working label Oct 27, 2024
Copy link
Collaborator

@adamperkowski adamperkowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@ChrisTitusTech ChrisTitusTech merged commit 17ff412 into ChrisTitusTech:main Nov 8, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants