Sha256: c5b950dc5e1247cfdef9d98ddf231060387c3b4f2f53eb3b7c462492cf4fb2b9

Contents?: true

Size: 280 Bytes

Versions: 1

Compression:

Stored size: 280 Bytes

Contents

def whoami_root(cmd)
  if `#{cmd}`.strip.chomp != 'root'
    $stderr.puts $run_as_root_msg || 'You need to be root to run this command.'
    exit $run_as_root_exit_code || 1
  end
end

['/usr/bin/whoami', '/bin/whoami'].each do |w|
  if File.exist? w
    whoami_root w
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
run-as-root-0.1.1 lib/run-as-root.rb