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:
parent
95a753daed
commit
e2dd14cee0
2 changed files with 4 additions and 3 deletions
|
@ -75,13 +75,14 @@ class Compiler
|
||||||
return args
|
return args
|
||||||
end
|
end
|
||||||
|
|
||||||
def run(input, output, args = nil)
|
def run(input, output, args = nil, options = { noerror: false })
|
||||||
all_args = default_args
|
all_args = default_args
|
||||||
if args
|
if args
|
||||||
all_args.push(*args)
|
all_args.push(*args)
|
||||||
end
|
end
|
||||||
all_args << "-o" << output << input
|
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
|
return stdout, stderr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -651,7 +651,7 @@ class Generator
|
||||||
file = File.join(dir, "test.cpp")
|
file = File.join(dir, "test.cpp")
|
||||||
File.open(file, 'w') {|file| file.write(buf.string)}
|
File.open(file, 'w') {|file| file.write(buf.string)}
|
||||||
dputs "Compiling #{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}"
|
dputs "Output: #{stderr}"
|
||||||
stderr
|
stderr
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue