diff --git a/libs/fst/scanner.cc b/libs/fst/scanner.cc index 85ac2d903f..a1ce9963e0 100644 --- a/libs/fst/scanner.cc +++ b/libs/fst/scanner.cc @@ -32,6 +32,7 @@ #include "pbd/pbd.h" #include "pbd/transmitter.h" #include "pbd/receiver.h" +#include "pbd/win_console.h" #ifdef __MINGW64__ #define NO_OLDNAMES // no backwards compat _pid_t, conflict with w64 pthread/sched @@ -94,6 +95,7 @@ class DummyReceiver : public Receiver { std::cerr << prefix << str << std::endl; if (chn == Transmitter::Fatal) { + console_madness_end (); ::exit (EXIT_FAILURE); } } @@ -103,6 +105,8 @@ DummyReceiver dummy_receiver; int main (int argc, char **argv) { char *dllpath = NULL; + console_madness_begin (); + if (argc == 3 && !strcmp("-f", argv[1])) { dllpath = argv[2]; const size_t slen = strlen (dllpath); @@ -118,6 +122,7 @@ int main (int argc, char **argv) { } else if (argc != 2) { fprintf(stderr, "usage: %s [-f] \n", argv[0]); + console_madness_end (); return EXIT_FAILURE; } else { dllpath = argv[1]; @@ -157,6 +162,8 @@ int main (int argc, char **argv) { PBD::cleanup(); + console_madness_end (); + if (!infos || infos->empty()) { return EXIT_FAILURE; } else { diff --git a/libs/fst/vst3-scanner.cc b/libs/fst/vst3-scanner.cc index aaa129f721..324d2eef01 100644 --- a/libs/fst/vst3-scanner.cc +++ b/libs/fst/vst3-scanner.cc @@ -32,6 +32,7 @@ #include "pbd/transmitter.h" #include "pbd/receiver.h" #include "pbd/pbd.h" +#include "pbd/win_console.h" #include "pbd/xml++.h" #ifdef __MINGW64__ @@ -70,6 +71,7 @@ protected: std::cout << prefix << str << std::endl; if (chn == Transmitter::Fatal) { + console_madness_end (); ::exit (EXIT_FAILURE); } } @@ -124,6 +126,8 @@ This tool ...\n\ printf ("Report bugs to \n" "Website: \n"); + + console_madness_end (); ::exit (EXIT_SUCCESS); } @@ -145,12 +149,15 @@ main (int argc, char **argv) }; /* clang-format on */ + console_madness_begin (); + int c = 0; while (EOF != (c = getopt_long (argc, argv, optstring, longopts, (int*)0))) { switch (c) { case 'V': printf ("ardour-vst3-scanner version %s\n\n", VERSIONSTRING); printf ("Copyright (C) GPL 2020 Robin Gareus \n"); + console_madness_end (); exit (EXIT_SUCCESS); break; @@ -168,6 +175,7 @@ main (int argc, char **argv) default: std::cerr << "Error: unrecognized option. See --help for usage information.\n"; + console_madness_end (); ::exit (EXIT_FAILURE); break; } @@ -175,6 +183,7 @@ main (int argc, char **argv) if (optind >= argc) { std::cerr << "Error: Missing parameter. See --help for usage information.\n"; + console_madness_end (); ::exit (EXIT_FAILURE); } @@ -201,6 +210,8 @@ main (int argc, char **argv) PBD::cleanup(); + console_madness_end (); + if (err) { return EXIT_FAILURE; } else {