From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#17036: Continuation for Emacs: invoking a process on exit? Date: Sun, 17 Apr 2022 15:34:55 +0300 Message-ID: <83wnfnyjkg.fsf@gnu.org> References: <874n2v9l10.fsf@igel.home> <874k2saqjh.fsf@gnus.org> <83y203yla1.fsf@gnu.org> <87fsmbap4e.fsf@gnus.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39164"; mail-complaints-to="usenet@ciao.gmane.io" Cc: rgm@gnu.org, 17036@debbugs.gnu.org, schwab@linux-m68k.org, rrt@sc3d.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 17 14:36:37 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ng48q-000A3F-NM for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 17 Apr 2022 14:36:36 +0200 Original-Received: from localhost ([::1]:42868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng48k-0006w3-1t for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 17 Apr 2022 08:36:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng48I-0006vd-6H for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2022 08:36:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41298) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng48H-0007Gy-TB for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2022 08:36:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ng48H-0002ZA-OD for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2022 08:36:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Apr 2022 12:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17036 X-GNU-PR-Package: emacs Original-Received: via spool by 17036-submit@debbugs.gnu.org id=B17036.16501989529847 (code B ref 17036); Sun, 17 Apr 2022 12:36:01 +0000 Original-Received: (at 17036) by debbugs.gnu.org; 17 Apr 2022 12:35:52 +0000 Original-Received: from localhost ([127.0.0.1]:35195 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ng487-0002Yl-Id for submit@debbugs.gnu.org; Sun, 17 Apr 2022 08:35:51 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55414) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ng483-0002YU-Uc for 17036@debbugs.gnu.org; Sun, 17 Apr 2022 08:35:49 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:49284) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng47u-0007FL-Dd; Sun, 17 Apr 2022 08:35:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=RbTdWB83ninlOa8q22LLG7O4wz73qfluOfjeDKtNznM=; b=qYosDH+qa8qF HzNnD6xrczP/b2EZchZWBa/JUpWnHvUP0svRdAjxNnrA2hAW9bwPT+M08BD9c6JpI9G/wY3Ou7/vS qyRoiIz6HD0oq/aHoGBcVSYQGiC3nAGYkR4PyQCatvsfCW10/91I9+8/Bf3TlZFK2iw9b8AScNRoM gbHBzZEa7ljaLu292bbAfntJePBn85qIFU7pReW8GcRu7gUKRkmUarBEzGgyP3z8M5Eb+qoNzxSrL KkvCEliCsxpZ5/f8+g2GqlhHV/Fe0YN6Ze/aca1YHF37+LADXFZp0edqFArwSxCIpYK2+m+IXPGel IT1Up1WaeKvRWnyRo4Le7A==; Original-Received: from [87.69.77.57] (port=1201 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng47S-0001QQ-Rw; Sun, 17 Apr 2022 08:35:13 -0400 In-Reply-To: <87fsmbap4e.fsf@gnus.org> (message from Lars Ingebrigtsen on Sun, 17 Apr 2022 14:08:49 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:230046 Archived-At: > From: Lars Ingebrigtsen > Cc: rgm@gnu.org, 17036@debbugs.gnu.org, schwab@linux-m68k.org, rrt@sc3d.org > Date: Sun, 17 Apr 2022 14:08:49 +0200 > > Eli Zaretskii writes: > > > As implemented, it won't work reliably on MS-Windows, because execvp > > there doesn't do what you think it should. I think we should use > > sys_spawnve instead. > > Ah, I grepped for execvp to see whether we already used it, but didn't > notice that the hits were from Gnulib. > > I'm not familiar with sys_spawnve -- can you do the adjustments? I don't think I will have the time. It isn't a simple job, because just calling sys_spawnve will not do -- that function currently supports only Emacs sub-processes. FTR, I will document below the potential issues with the current implementation of kill-emacs/restart-emacs: . when kill-emacs is called with RESTART non-nil, the value of ARG is ignored; this should at least be documented; . the exit status of the restarted Emacs is discarded, so it will not be available to the parent program, at least on MS-Windows, and also if execvp fails for some reason; . the semantics of the file descriptors open in the original Emacs process is not clear to me: will they remain open in the restarted Emacs, if the original Emacs opened them without CLOEXEC? . does the restarted Emacs belong to the same process group? should it? . on MS-Windows, if any of the argv[] command-line arguments have embedded whitespace, the restarted Emacs will not get the same elements in its argv[] array, because the Windows API for starting processes accepts the command-line arguments as a single string