Terminate script

This commit is contained in:
badaix 2023-01-23 20:56:49 +01:00
parent c01ba2bdde
commit 63de108800
2 changed files with 9 additions and 2 deletions

View file

@ -253,7 +253,14 @@ void ScriptStreamControl::stop()
{
if (process_.running())
{
LOG(INFO, LOG_TAG) << "Stopping script '" << script_ << "'\n";
::kill(-process_.native_handle(), SIGINT);
auto timeout = 500ms;
if (!process_.wait_for(timeout))
{
LOG(INFO, LOG_TAG) << "Script did not terminate after " << timeout.count() << " ms, terminating.\n";
process_.terminate();
}
}
}