3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/extensions/thor/actions.rb', line 3
def run(command, config = {})
return unless behavior == :invoke
destination = relative_to_original_destination_root(destination_root, false)
desc = "#{command} from #{destination.inspect}"
if config[:with]
desc = "#{File.basename(config[:with].to_s)} #{desc}"
command = "#{config[:with]} #{command}"
end
say_status :run, desc, config.fetch(:verbose, true)
unless options[:pretend]
if config[:capture]
result = `#{command}`
status = $?.exitstatus
else
result = system("#{command}")
status = result ? 0 : 1
end
if config[:exit_on_failure]
status == 0 or exit status
end
result
end
end
|