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: os.userInfo() might throw SystemError if homedir isn't available #78

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

cyjake
Copy link
Owner

@cyjake cyjake commented Apr 7, 2024

fixes #77

Copy link

codecov bot commented Apr 7, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 96.88%. Comparing base (162eaa3) to head (7ec2a55).

Files Patch % Lines
src/ssh-config.ts 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #78      +/-   ##
==========================================
- Coverage   97.16%   96.88%   -0.29%     
==========================================
  Files           3        3              
  Lines         318      321       +3     
  Branches       87       88       +1     
==========================================
+ Hits          309      311       +2     
  Misses          4        4              
- Partials        5        6       +1     

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

@cyjake cyjake force-pushed the fix-userinfo-systemerror branch 5 times, most recently from 2dbdb93 to ecde706 Compare April 7, 2024 09:39
@cyjake cyjake merged commit fdc22da into master Apr 8, 2024
4 of 6 checks passed
@cyjake cyjake deleted the fix-userinfo-systemerror branch April 8, 2024 02:31
try {
userInfo = os.userInfo()
} catch {
// os.userInfo() throws a SystemError if a user has no username or homedir.

Choose a reason for hiding this comment

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

FYI: this comment isn't necessarily precise

namely this can happen as well if the user is a "remote" user (e.g. LDAP scenario)

Copy link
Owner Author

Choose a reason for hiding this comment

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

It was copied from the documentation of os.userInfo() 😂 I guess if the user is "remote", homedir won't be available as well?

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.

'compute' can throw for user using ldap
2 participants