#ifndef DOCKERUTILITY_H #define DOCKERUTILITY_H #include #include #include #include /** * @brief used when app run on the native machine */ class DockerUtility { public: void stop(const std::string &nameFilter); static bool supervisorStatus(std::string_view container, const std::string &module); template static void runScript(std::string_view container, const std::string &script, Args &&...scriptArgs); static bool running(std::string_view container, std::error_code &error); static void executeBashCommand(const std::string &command); static void execute(const std::string_view &container, const std::string_view &command); static void kill(const std::string &nameFilter); static bool containerExisted(const std::string_view &name); /** * @brief supervisorctl * @param module * @param isStart true:start,false:stop */ static void supervisorctl(const std::string_view &container, const std::string &module, bool isStart); private: DockerUtility() = default; }; class NativeUtility { public: using ShellCommand = std::true_type; template static void runScript(const std::string &script, Args &&...scriptArgs); static bool processRunning(const std::string &nameFilter); static std::string currentExecutable(); static std::string executableDirectory(); static std::string applicationDataDirectory(bool create = true); static std::string homeDirectory(); private: NativeUtility() = default; }; #include "ProcessUtility.inl" #endif // DOCKERUTILITY_H