Module: Unix

Included in:
Linux, MacOS
Defined in:
lib/pretest/config/unix.rb

Instance Method Summary collapse

Instance Method Details

#remove_bin(file) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/pretest/config/unix.rb', line 8

def remove_bin(file)
  output, _status = Open3.capture2("which #{file}")
  return false if output.nil?
  return false if output.empty?

  output = output.delete("\n") unless output.empty?
  until output.empty?
    system "sudo rm -rf #{output}"
    output, _status = Open3.capture2("which #{file}").delete("\n")
    output = '' if output.nil?
    output = output.delete("\n") unless output.empty?
  end
end