main: catch exception, to finish cleanly

This commit is contained in:
Gwenhael Goavec-Merou 2020-02-16 16:55:37 +01:00
parent ad50f1a19b
commit 849e5751e0
1 changed files with 9 additions and 2 deletions

View File

@ -170,8 +170,15 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
if (!args.bit_file.empty())
fpga->program(args.offset);
if (!args.bit_file.empty()) {
try {
fpga->program(args.offset);
} catch (std::exception &e) {
delete(fpga);
delete(jtag);
return EXIT_FAILURE;
}
}
if (args.reset)
fpga->reset();