This is an automated email from the ASF dual-hosted git repository. isapego pushed a commit to branch ignite-17424 in repository https://gitbox.apache.org/repos/asf/ignite-3.git
commit ba4e87ea7cd6f939f89565270c0cfdec057250f0 Author: Igor Sapego <isap...@apache.org> AuthorDate: Wed Aug 31 09:06:32 2022 +0400 IGNITE-17424 Re-factoring --- .../cpp/test-common/include/ignite_node.h | 2 +- .../platforms/cpp/test-common/src/ignite_node.cpp | 14 ++++---- .../cpp/test-common/src/win/win_process.h | 40 +++++++++++----------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/modules/platforms/cpp/test-common/include/ignite_node.h b/modules/platforms/cpp/test-common/include/ignite_node.h index 4850e07624..5a34c4c2b1 100644 --- a/modules/platforms/cpp/test-common/include/ignite_node.h +++ b/modules/platforms/cpp/test-common/include/ignite_node.h @@ -64,7 +64,7 @@ public: private: /** Underlying process. */ - std::unique_ptr<Process> process; + std::unique_ptr<Process> m_process; }; } // namespace ignite diff --git a/modules/platforms/cpp/test-common/src/ignite_node.cpp b/modules/platforms/cpp/test-common/src/ignite_node.cpp index 3c6f7ab6a3..8b75cb30b7 100644 --- a/modules/platforms/cpp/test-common/src/ignite_node.cpp +++ b/modules/platforms/cpp/test-common/src/ignite_node.cpp @@ -55,10 +55,10 @@ void IgniteNode::start(bool dryRun) std::cout << "working dir=" << workDir << std::endl; std::cout << "command=" << command << std::endl; - process = Process::make(command, workDir.string()); - if (!process->start()) + m_process = Process::make(command, workDir.string()); + if (!m_process->start()) { - process.reset(); + m_process.reset(); throw std::runtime_error("Failed to invoke Ignite command: '" + command + "'"); } @@ -66,14 +66,14 @@ void IgniteNode::start(bool dryRun) void IgniteNode::stop() { - if (process) - process->kill(); + if (m_process) + m_process->kill(); } void IgniteNode::join(std::chrono::milliseconds timeout) { - if (process) - process->join(timeout); + if (m_process) + m_process->join(timeout); } } // namespace ignite \ No newline at end of file diff --git a/modules/platforms/cpp/test-common/src/win/win_process.h b/modules/platforms/cpp/test-common/src/win/win_process.h index b0c29c5941..b52be1aa73 100644 --- a/modules/platforms/cpp/test-common/src/win/win_process.h +++ b/modules/platforms/cpp/test-common/src/win/win_process.h @@ -82,10 +82,10 @@ public: * @param workDir Working directory. */ WinProcess(std::string command, std::string workDir) : - running(false), - command(std::move(command)), - workDir(std::move(workDir)), - info{} + m_running(false), + m_command(std::move(command)), + m_workDir(std::move(workDir)), + m_info{} { } /** @@ -99,26 +99,26 @@ public: */ bool start() override { - if (running) + if (m_running) return false; STARTUPINFO si; std::memset(&si, 0, sizeof(si)); si.cb = sizeof(si); - std::memset(&info, 0, sizeof(info)); + std::memset(&m_info, 0, sizeof(m_info)); - std::vector<char> cmd(command.begin(), command.end()); + std::vector<char> cmd(m_command.begin(), m_command.end()); cmd.push_back(0); BOOL success = CreateProcess( NULL, cmd.data(), NULL, NULL, - FALSE, 0, NULL, workDir.c_str(), - &si, &info); + FALSE, 0, NULL, m_workDir.c_str(), + &si, &m_info); - running = success == TRUE; + m_running = success == TRUE; - return running; + return m_running; } /** @@ -126,7 +126,7 @@ public: */ void kill() override { - std::vector<DWORD> processTree = getProcessTree(info.dwProcessId); + std::vector<DWORD> processTree = getProcessTree(m_info.dwProcessId); for (auto procId : processTree) { HANDLE hChildProc = ::OpenProcess(PROCESS_ALL_ACCESS, FALSE, procId); @@ -137,10 +137,10 @@ public: } } - TerminateProcess(info.hProcess, 1); + TerminateProcess(m_info.hProcess, 1); - CloseHandle( info.hProcess ); - CloseHandle( info.hThread ); + CloseHandle(m_info.hProcess ); + CloseHandle(m_info.hThread ); } /** @@ -152,21 +152,21 @@ public: { auto msecs = timeout.count() < 0 ? INFINITE : static_cast<DWORD>(timeout.count()); - WaitForSingleObject(info.hProcess, msecs); + WaitForSingleObject(m_info.hProcess, msecs); } private: /** Running flag. */ - bool running; + bool m_running; /** Command. */ - const std::string command; + const std::string m_command; /** Working directory. */ - const std::string workDir; + const std::string m_workDir; /** Process information. */ - PROCESS_INFORMATION info; + PROCESS_INFORMATION m_info; }; } // namespace ignite::win