From 60d791fee684aaa847b4987542b753b772b989ba Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 1 May 2024 08:02:57 +0200 Subject: Add startupcheck --- src/DabMod.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/DabMod.cpp') diff --git a/src/DabMod.cpp b/src/DabMod.cpp index 648b7ad..f238ca4 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -394,6 +394,25 @@ int launch_modulator(int argc, char* argv[]) throw std::runtime_error("Configuration error: Output not specified"); } + if (not mod_settings.startupCheck.empty()) { + etiLog.level(info) << "Running startup check '" << mod_settings.startupCheck << "'"; + int wstatus = system(mod_settings.startupCheck.c_str()); + + if (WIFEXITED(wstatus)) { + if (WEXITSTATUS(wstatus) == 0) { + etiLog.level(info) << "Startup check ok"; + } + else { + etiLog.level(error) << "Startup check failed, returned " << WEXITSTATUS(wstatus); + return 1; + } + } + else { + etiLog.level(error) << "Startup check failed, child didn't terminate normally"; + return 1; + } + } + printModSettings(mod_settings); ModulatorData m; -- cgit v1.2.3