System.cc
Go to the documentation of this file.
1 #include <utl/System.h>
2 #include <utl/ErrorLogger.h>
3 #include <utl/AugerException.h>
4 #include <cstdlib>
5 
6 
7 namespace utl {
8 
9  void
10  System(const char* const command, const bool throwOnError, const bool notify)
11  {
12  if (notify) {
13  std::ostringstream info;
14  info << "Running command: " << command;
15  INFO(info);
16  }
17  const int status = std::system(command);
18  if (status) {
19  std::ostringstream msg;
20  msg << "Nonzero status return from command: " << command;
21  if (throwOnError) {
22  ERROR(msg);
23  throw DoesNotComputeException(msg.str());
24  }
25  WARNING(msg);
26  }
27  }
28 
29 }
void System(const char *const command, const bool throwOnError, const bool notify)
Definition: System.cc:10
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
#define WARNING(message)
Macro for logging warning messages.
Definition: ErrorLogger.h:163
Base class for inconsistency/illogicality exceptions.
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165

, generated on Tue Sep 26 2023.