File: platform_helpers.rb

package info (click to toggle)
ruby-mixlib-shellout 3.2.5-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 404 kB
  • sloc: ruby: 2,854; makefile: 4
file content (21 lines) | stat: -rw-r--r-- 309 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
def windows?
  !!(RUBY_PLATFORM =~ /mswin|mingw|windows/)
end

def unix?
  !windows?
end

if windows?
  LINE_ENDING = "\r\n".freeze
  ECHO_LC_ALL = "echo %LC_ALL%".freeze
else
  LINE_ENDING = "\n".freeze
  ECHO_LC_ALL = "echo $LC_ALL".freeze
end

def root?
  return false if windows?

  Process.euid == 0
end