! * \brief Terminates all processes in the group forcefully and waits until they're gone. */
| 743 | * \brief Terminates all processes in the group forcefully and waits until they're gone. |
| 744 | */ |
| 745 | void SyncthingProcess::handleLeftoverProcesses() |
| 746 | { |
| 747 | #ifdef LIB_SYNCTHING_CONNECTOR_BOOST_PROCESS |
| 748 | if (!m_process->group.valid()) { |
| 749 | return; |
| 750 | } |
| 751 | auto ec = std::error_code(); |
| 752 | m_process->group.terminate(ec); |
| 753 | if (ec && ec != std::errc::no_such_process) { |
| 754 | std::cerr << EscapeCodes::Phrases::Error << "Unable to kill leftover processes in group " << m_process->group.native_handle() << ": " |
| 755 | << ec.message() << EscapeCodes::Phrases::End; |
| 756 | } |
| 757 | if (!m_process->group.valid()) { |
| 758 | return; |
| 759 | } |
| 760 | m_process->group.wait(ec); // wait until group has terminated: Is this ever required? |
| 761 | if (ec && ec != std::errc::no_such_process) { |
| 762 | std::cerr << EscapeCodes::Phrases::Error << "Unable to wait for leftover processes in group " << m_process->group.native_handle() << ": " |
| 763 | << ec.message() << EscapeCodes::Phrases::End; |
| 764 | } |
| 765 | #endif |
| 766 | } |
| 767 | |
| 768 | qint64 SyncthingProcess::bytesAvailable() const |
| 769 | { |