Skip to content
Snippets Groups Projects
Commit 78867931 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Kirill Yukhin
Browse files

popen: add ability to keep child on deletion


Currently popen_delete kills all children process.
Moreover we use popen_delete on tarantool exit.

Alexander pointed out that keep children running
even if tarantool is exited is still needed.

Part of #4031

Reported-by: default avatarAlexander Turenko <alexander.turenko@tarantool.org>
Acked-by: default avatarAlexander Turenko <alexander.turenko@tarantool.org>
Signed-off-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
parent 393f0bbf
No related branches found
No related tags found
No related merge requests found
......@@ -585,12 +585,15 @@ popen_delete(struct popen_handle *handle)
assert(handle != NULL);
/*
* Unable to kill the process -- give an error.
* The process is not exist already -- pass over.
*/
if (popen_send_signal(handle, SIGKILL) != 0 && errno != ESRCH)
return -1;
if ((handle->flags & POPEN_FLAG_KEEP_CHILD) == 0) {
/*
* Unable to kill the process -- give an error.
* The process is not exist already -- pass over.
*/
if (popen_send_signal(handle, SIGKILL) != 0 &&
errno != ESRCH)
return -1;
}
for (i = 0; i < lengthof(handle->ios); i++) {
if (handle->ios[i].fd != -1)
......
......@@ -102,6 +102,12 @@ enum popen_flag_bits {
*/
POPEN_FLAG_GROUP_SIGNAL_BIT = 16,
POPEN_FLAG_GROUP_SIGNAL = (1 << POPEN_FLAG_GROUP_SIGNAL_BIT),
/*
* Keep child running on delete.
*/
POPEN_FLAG_KEEP_CHILD_BIT = 17,
POPEN_FLAG_KEEP_CHILD = (1 << POPEN_FLAG_KEEP_CHILD_BIT),
};
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment