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

Fix incorrect string operations on bytes output of 'ps' subprocess #1765

Conversation

parikshittiwari740
Copy link
Contributor

@parikshittiwari740 parikshittiwari740 commented Jun 2, 2024

The subprocess to get the current shell name would always return a bytes output. The subsequent string operations on
that output would always fail with a TypeError.

Using subprocess.run() along with its text flag will fix the issue at hand as well as bring the code in-line with python's
recommendation of using run for all use cases it can handle. The current use case does not warrant a use for subprocess.communicate()
.

Closes #1754

@parikshittiwari740 parikshittiwari740 requested a review from a team as a code owner June 2, 2024 10:39
Copy link

linux-foundation-easycla bot commented Jun 2, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: parikshittiwari740 / name: Parikshit Tiwari (7103dcb)
  • ✅ login: JeanChristopheMorinPerso / name: Jean-Christophe Morin (8699a35, 839d5aa)

src/rez/utils/_version.py Outdated Show resolved Hide resolved
src/rez/system.py Show resolved Hide resolved
@JeanChristopheMorinPerso JeanChristopheMorinPerso added this to the Next milestone Jun 22, 2024
Signed-off-by: Jean-Christophe Morin <[email protected]>
Signed-off-by: Jean-Christophe Morin <[email protected]>
Copy link

codecov bot commented Jun 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.93%. Comparing base (a13f7bb) to head (839d5aa).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1765      +/-   ##
==========================================
- Coverage   58.41%   57.93%   -0.48%     
==========================================
  Files         126      126              
  Lines       17163    17134      -29     
  Branches     3506     3519      +13     
==========================================
- Hits        10025     9926      -99     
- Misses       6473     6533      +60     
- Partials      665      675      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JeanChristopheMorinPerso JeanChristopheMorinPerso merged commit 57136a3 into AcademySoftwareFoundation:main Jun 29, 2024
47 checks passed
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

Successfully merging this pull request may close these issues.

Shell type plugin can resolve incorrectly in rez.system on Linux.
2 participants