From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id C61BE4696C3 for ; Mon, 2 Mar 2020 23:13:41 +0300 (MSK) Received: by mail-lj1-f195.google.com with SMTP id d10so882881ljl.9 for ; Mon, 02 Mar 2020 12:13:41 -0800 (PST) From: Cyrill Gorcunov Date: Mon, 2 Mar 2020 23:12:26 +0300 Message-Id: <20200302201227.31785-7-gorcunov@gmail.com> In-Reply-To: <20200302201227.31785-1-gorcunov@gmail.com> References: <20200302201227.31785-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 6/7] popen: handle setsid os specifics List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tml On linux it is fine to call setsid right after the vfork, in turn on bsd pgrp should be used. Signed-off-by: Cyrill Gorcunov --- src/lib/core/popen.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/core/popen.c b/src/lib/core/popen.c index 6e5ca21bd..d41e9cfce 100644 --- a/src/lib/core/popen.c +++ b/src/lib/core/popen.c @@ -839,8 +839,15 @@ popen_new(struct popen_opts *opts) */ if (opts->flags & POPEN_FLAG_SETSID) { if (setsid() == -1) { +#ifndef TARGET_OS_DARWIN say_syserror("child: setsid failed"); goto exit_child; +#else + if (setpgrp() == -1) { + say_syserror("child: setpgrp failed"); + goto exit_child; + } +#endif } } -- 2.20.1