fix exit status: several executables reported success (0) on failure or vice versa
Build and Deploy Documentation / build-and-deploy (push) Successful in 23s

Two bug patterns fixed across src/*.cpp:

- musrfit, musrview, any2many, addRun, musrFT, musrt0: a local
  success/ok/isGood flag was tracked and an error printed, but the
  function fell through to an unconditional `return PMUSR_SUCCESS;`
  at the end instead of propagating the failure.
- msr2data, msr2msr: the success path returned a nonzero code (1)
  instead of 0.

Also propagate previously-ignored return codes to the process exit
status in dump_header (format-dispatch functions), musrRootValidation
(schema validation / consistency checks), and write_musrRoot_runHeader
(FillFolder failure).
This commit is contained in:
suter_a committed 2026-08-27 12:38:46 +02:00
1 parent b21b26d307
commit 32f2d3defa
11 files changed
+54 -13

No files matched your search

+8 -6
View File
@@ -1083,21 +1083,23 @@ int main(int argc, char *argv[])
boost::to_lower(fileFormat);
int status = 0;
if (boost::iequals(fileFormat, "MusrRoot") || boost::iequals(fileFormat, "ROOT")) {
dump_header_root(pathFln, summary, counts);
status = dump_header_root(pathFln, summary, counts);
} else if (boost::iequals(fileFormat, "NeXus")) {
#ifdef PNEXUS_ENABLED
dump_header_nexus(pathFln, counts);
status = dump_header_nexus(pathFln, counts);
#else
std::cout << std::endl << "Sorry, NeXus is not enabled, hence I cannot help you." << std::endl;
status = 1;
#endif
} else if (boost::iequals(fileFormat, "PSI-BIN") || boost::iequals(fileFormat, "PSI-MDU")) {
dump_header_psi_bin(pathFln, fileFormat, counts);
status = dump_header_psi_bin(pathFln, fileFormat, counts);
} else if (boost::iequals(fileFormat, "MUD")) {
dump_header_mud(pathFln, counts);
status = dump_header_mud(pathFln, counts);
} else if (boost::iequals(fileFormat, "WKM")) {
dump_header_wkm(pathFln);
status = dump_header_wkm(pathFln);
}
return 0;
return status;
}