Я бы хотел реализовать следующие функции с помощью boost :: process (отправить сигнал выключения, завершить процесс после истечения времени ожидания):
QProcess *process = getProcess();
process->terminate();
int timeout_ms = 10*1000;
if (!process->waitForFinished(timeout_ms) {
process->kill;
}
boost::process::child::terminate()
отправляет принудительное уничтожение процессу, а не что мне нужно здесь
Из документов QProcess:
[slot]void QProcess::terminate()
Attempts to terminate the process.
The process may not exit as a result of calling this function (it is given the chance to prompt the user for any unsaved files, etc).
On Windows, terminate() posts a WM_CLOSE message to all top-level windows of the process and then to the main thread of the process itself. On Unix and macOS the SIGTERM signal is sent.
Console applications on Windows that do not run an event loop, or whose event loop does not handle the WM_CLOSE message, can only be terminated by calling kill().
Итак, вопрос: есть ли простой способ иметь такое поведение с boost, без переопределения того, что делает QProcess. Примечание: целевая платформа Windows.