Sha256: 1d2516dbc0f47c751ce58f09b8723fd11ed91b0d43e0a40bd12f948e0251ae87

Contents?: true

Size: 326 Bytes

Versions: 1

Compression:

Stored size: 326 Bytes

Contents

require "open3"

def command?(name)
  system "which", name, out: File::NULL, err: File::NULL
  $?.success?
end

def which(name)
  (Open3.capture2 "which", name).first.chop
end

def selinux_context(name)
  ctx = (Open3.capture2 "stat", which(name)).first.match(/Context: (.*)/)
  if ctx.instance_of? Array
    ctx[1]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cvefixer-0.6.6 lib/helpers.rb