diff options
Diffstat (limited to 'src/process.cpp')
-rw-r--r-- | src/process.cpp | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/src/process.cpp b/src/process.cpp index 2fe6f4b..bac8bb8 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -161,9 +161,9 @@ Handle shell_execute(const ShellParameters& params) { } // namespace ProcessParameters::ProcessParameters(ProcessParameters&& other) BOOST_NOEXCEPT_OR_NOTHROW - : cmd_line{std::move(other.cmd_line)}, - io{std::move(other.io)}, - console_mode{std::move(other.console_mode)} {} + : cmd_line(std::move(other.cmd_line)), + io(std::move(other.io)), + console_mode(std::move(other.console_mode)) {} ProcessParameters& ProcessParameters::operator=(ProcessParameters other) BOOST_NOEXCEPT_OR_NOTHROW { swap(other); @@ -177,13 +177,9 @@ void ProcessParameters::swap(ProcessParameters& other) BOOST_NOEXCEPT_OR_NOTHROW swap(console_mode, other.console_mode); } -void swap(ProcessParameters& a, ProcessParameters& b) BOOST_NOEXCEPT_OR_NOTHROW { - a.swap(b); -} - ShellParameters::ShellParameters(ShellParameters&& other) BOOST_NOEXCEPT_OR_NOTHROW - : ProcessParameters{std::move(other)}, - verb{std::move(verb)} {} + : ProcessParameters(std::move(other)), + verb(std::move(verb)) {} ShellParameters& ShellParameters::operator=(ShellParameters other) BOOST_NOEXCEPT_OR_NOTHROW { swap(other); @@ -196,28 +192,6 @@ void ShellParameters::swap(ShellParameters& other) BOOST_NOEXCEPT_OR_NOTHROW { swap(verb, other.verb); } -void swap(ShellParameters& a, ShellParameters& b) BOOST_NOEXCEPT_OR_NOTHROW { - a.swap(b); -} - -Process::Process(Process&& other) BOOST_NOEXCEPT_OR_NOTHROW { - swap(other); -} - -Process& Process::operator=(Process other) BOOST_NOEXCEPT_OR_NOTHROW { - swap(other); - return *this; -} - -void Process::swap(Process& other) BOOST_NOEXCEPT_OR_NOTHROW { - using std::swap; - swap(m_handle, other.m_handle); -} - -void swap(Process& a, Process& b) BOOST_NOEXCEPT_OR_NOTHROW { - a.swap(b); -} - Process Process::create(ProcessParameters params) { return Process{create_process(params)}; } @@ -242,6 +216,20 @@ Process Process::shell(const CommandLine& cmd_line) { return shell(params); } +Process::Process(Process&& other) BOOST_NOEXCEPT_OR_NOTHROW { + swap(other); +} + +Process& Process::operator=(Process other) BOOST_NOEXCEPT_OR_NOTHROW { + swap(other); + return *this; +} + +void Process::swap(Process& other) BOOST_NOEXCEPT_OR_NOTHROW { + using std::swap; + swap(m_handle, other.m_handle); +} + bool Process::is_running() const { const auto ret = ::WaitForSingleObject(static_cast<HANDLE>(m_handle), 0); |