Skip to content

Commit

Permalink
fix: Use '/etc/os-release' to check for Linux
Browse files Browse the repository at this point in the history
In build environments like Fedora's mockbuild, there is no OSTYPE
environment variable set. Use a more secure method to detect Linux.
Details:

man os-release
https://www.man7.org/linux/man-pages/man5/os-release.5.html
  • Loading branch information
cryptomilk committed Jan 13, 2024
1 parent 77f1bd3 commit 8abc451
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ else
-- Normal lua will only have \ for path separator on windows.
utils.isWindows = package.config:find("\\") and true or false
if not utils.isWindows then
local _os = os.getenv('RUNNER_OS') or os.getenv('OSTYPE')
if (_os and _os:lower():match('linux')) then
if uv.fs_stat('/etc/os-release') then
utils.isLinux = true
end
end
Expand Down

0 comments on commit 8abc451

Please sign in to comment.