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
32
33
34
|
# File 'lib/build/jakercc.rb', line 6
def self.run3_dont_fail(command, cd = nil, env = {})
set_list = []
env.each_pair do |k, v|
if RUBY_PLATFORM =~ /(win|w)32$/
set_list << "set \"#{k}=#{v}\"&&"
else
set_list << "export #{k}=#{v}&&"
end
end
to_print = "CMD: #{command}"
to_run = set_list.join('') + command
if !cd.nil?
to_print = "PWD: #{cd}\n#{to_print}"
if RUBY_PLATFORM =~ /(win|w)32$/
cd_ = cd.gsub('/', "\\")
to_run = "cd /d \"#{cd_}\"&&#{to_run}"
else
to_run = "cd '#{cd}'&&#{to_run}"
end
end
if !env.nil?
to_print = "ENV: #{env}\n#{to_print}"
end
system(to_run)
end
|