Prevent error messages while detecting OS #40
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using tide on openSUSE Tumbleweed causes the following to be printed out when opening a new shell:
This pull request fixes this by short-circuiting
_tide_detect_os_linux_cases
and returning 1 if the given file does not exist.Description
At the top of
_tide_detect_os_linux_cases
, a check was added to test if the given path is a file and, if not,return 1
.Note: I considered using
test -e
to allow for symbolic links, but decided against it because it also returns true fordirectories, which would be invalid. AFAIK,
/etc/os-release
and/etc/lsb-release
are not symlinks on any distros, if they exist, so using-f
should be fine?test -L
could also be used, but I don't think it checks if the target of the link is a file, and implementing a thorough check usingreadlink
is only something the occurred to me while writing this pull request and seems unnecessary for the files being checked.How Has This Been Tested
I tested the logic manually in the shell just to be sure, but it's a simple enough line of code that I think it can be verified as correct by looking at it.
Checklist
I do not think there are any tests for this, since it occurs during installation. If I am wrong, I can go back and modify tests. Similarly, I do not think there is any documentation related to this.