Add DOH Exit() and SetExitHandler()
Exit() is a wrapper for exit() by default, but SetExitHandler() allows specifying a function to call instead. This means that failures within DOH (e.g. Malloc() failing due to lack of memory) will now perform cleanup such as removing output files. This commit also cleans up exit statuses so SWIG should now reliably exit with status 0 if the run was successful and status 1 if there was an error (or a warning and -Werror was in effect). Previously in some situations SWIG would try to exit with the status set to the number of errors encountered, but that's problematic - for example if there were 256 errors this would result in exit status 0 on most platforms. Also some error statuses have special meanings e.g. those defined by <sysexits.h>. Also SWIG/Javascript tried to exit with status -1 in a few places (which typically results in exit status 255).
This commit is contained in:
parent
7bdef23304
commit
55377bdc08
33 changed files with 243 additions and 173 deletions
|
|
@ -119,7 +119,7 @@ public:
|
|||
} else if (strcmp(argv[i], "-nocppcast") == 0) {
|
||||
Printf(stderr, "Deprecated command line option: %s. This option is no longer supported.\n", argv[i]);
|
||||
Swig_mark_arg(i);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
Exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -167,7 +167,7 @@ public:
|
|||
f_begin = NewFile(outfile, "w", SWIG_output_files());
|
||||
if (!f_begin) {
|
||||
FileErrorDisplay(outfile);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
Exit(EXIT_FAILURE);
|
||||
}
|
||||
f_runtime = NewString("");
|
||||
f_header = NewString("");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue