Module: Pindo::Plistbuddyexecutable
Defined Under Namespace
Classes: Plistbuddyindenter
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.plistbuddy_execute_command(executable, command, raise_on_failure = true) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/pindo/base/plistbuddyexecutable.rb', line 16
def self.plistbuddy_execute_command(executable, command, raise_on_failure = true)
bin = '/usr/libexec/PlistBuddy'
command = command.map(&:to_s)
full_command = "#{bin} #{command.join(' ')}"
puts "$ #{full_command}"
stdout = Plistbuddyindenter.new(STDOUT)
stderr = Plistbuddyindenter.new(STDERR)
status = plistbuddy_popen3(bin, command, stdout, stderr)
stdout = stdout.join
stderr = stderr.join
output = stdout + stderr
unless status.success?
if raise_on_failure
raise Informative, "#{full_command}\n\n#{output}"
else
puts "[!] Failed: #{full_command}"
end
end
output
end
|
Instance Method Details
#plistbuddyexecutable(name) ⇒ Object