From 39be58e3cf0467f217a11e944fbe4f76efedea90 Mon Sep 17 00:00:00 2001 From: matv864 <matv864@gmail.com> Date: Thu, 9 Jan 2025 22:54:12 +1000 Subject: [PATCH] occasionaly deleted --- main.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 main.cpp diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..4f529b2 --- /dev/null +++ b/main.cpp @@ -0,0 +1,29 @@ +#include "process_launcher.h" +#include <iostream> +#include <string> + +int main() { + std::string command; + + // В зависимости от ОС, выберем команду для запуска +#ifdef _WIN32 + command = "cmd /C echo Hello, World!"; +#else + command = "echo Hello, World!"; +#endif + + // Запускаем процесс + int pid = ProcessLauncher::launch(command); + if (pid == -1) { + std::cerr << "Не удалось запустить процесс." << std::endl; + return -1; + } + + std::cout << "Процесс с PID: " << pid << " запущен." << std::endl; + + // Ожидаем завершения процесса + int exitCode = ProcessLauncher::waitForProcess(pid); + std::cout << "Процесс завершился с кодом: " << exitCode << std::endl; + + return 0; +} \ No newline at end of file