1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-19 14:25:16 +03:00

Improve build system error handling

This commit is contained in:
Michel Pastor 2017-11-01 19:02:22 +01:00
parent 95a753daed
commit e2dd14cee0
2 changed files with 4 additions and 3 deletions

View file

@ -75,13 +75,14 @@ class Compiler
return args
end
def run(input, output, args = nil)
def run(input, output, args = nil, options = { noerror: false })
all_args = default_args
if args
all_args.push(*args)
end
all_args << "-o" << output << input
stdout, stderr = Open3.capture3(join_args(all_args))
stdout, stderr, compile_status = Open3.capture3(join_args(all_args))
raise "Compiler error:\n#{all_args.join(' ')}\n#{stderr}" if not options[:noerror] and not compile_status.success?
return stdout, stderr
end

View file

@ -651,7 +651,7 @@ class Generator
file = File.join(dir, "test.cpp")
File.open(file, 'w') {|file| file.write(buf.string)}
dputs "Compiling #{buf.string}"
stdout, stderr = @compiler.run(file, File.join(dir, "test"))
stdout, stderr = @compiler.run(file, File.join(dir, "test"), '-c', noerror: true)
dputs "Output: #{stderr}"
stderr
end