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:41:06 +0300 Message-ID: <83v8v7yja5.fsf@gnu.org> References: <874n2v9l10.fsf@igel.home> <874k2saqjh.fsf@gnus.org> <83y203yla1.fsf@gnu.org> <87fsmbap4e.fsf@gnus.org> <83wnfnyjkg.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27909"; mail-complaints-to="usenet@ciao.gmane.io" Cc: rgm@gnu.org, 17036@debbugs.gnu.org, schwab@linux-m68k.org, rrt@sc3d.org To: larsi@gnus.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 17 14:42:54 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 1ng4Eu-00075U-TO for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 17 Apr 2022 14:42:53 +0200 Original-Received: from localhost ([::1]:45030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng4Es-0000tN-Vn for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 17 Apr 2022 08:42:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng4EP-0000pV-6U for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2022 08:42:21 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41312) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng4E6-0000Mm-Nn for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2022 08:42:20 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ng4E6-0002j5-Fr for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2022 08:42:02 -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:42:02 +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.165019929310438 (code B ref 17036); Sun, 17 Apr 2022 12:42:02 +0000 Original-Received: (at 17036) by debbugs.gnu.org; 17 Apr 2022 12:41:33 +0000 Original-Received: from localhost ([127.0.0.1]:35209 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ng4Dc-0002iH-RU for submit@debbugs.gnu.org; Sun, 17 Apr 2022 08:41:33 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55590) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ng4DX-0002i0-FH for 17036@debbugs.gnu.org; Sun, 17 Apr 2022 08:41:31 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:49306) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng4DS-0000F5-67; Sun, 17 Apr 2022 08:41:22 -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=nJI+Pqma0VuMR9M3ddSs/CEiFTal4fLcqHT57Os7nJA=; b=kLPEwDH6ozUk J+GPrhOQXysQlBmzegkt/YCQ9XuHzYTJzWj/trTVB74g10LBLZ4K+aTr5eRWTbHV/GIsD6SNG27NW obg2ammxLDRk0c7B+J4pcQD5AXeQqXSP6YUd3OOuQmevQb3wWhhNo4XgvSAfowW/nz6MMeJd1dvLh rUA4gBAdmemFxMcmYE90WK7RhqHh3zT88dqw1dOWOB7qy+nNWsF4ybeaV6v2LAUyMffDgUnPXzkYG VmNRr8AtmpVC2F1Ykzyd/3b/EWDZYHk09rMUTSJxHBSr5jw/TDrwlahlAvhi6vfTSgnGTFrwubFoT a5CeSmA7sc4dgVm5C7kagQ==; Original-Received: from [87.69.77.57] (port=1594 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 1ng4DR-0006D6-Jm; Sun, 17 Apr 2022 08:41:21 -0400 In-Reply-To: <83wnfnyjkg.fsf@gnu.org> (message from Eli Zaretskii on Sun, 17 Apr 2022 15:34:55 +0300) 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:230048 Archived-At: > Resent-From: Eli Zaretskii > Original-Sender: "Debbugs-submit" > Resent-CC: bug-gnu-emacs@gnu.org > Resent-Sender: help-debbugs@gnu.org > Date: Sun, 17 Apr 2022 15:34:55 +0300 > From: Eli Zaretskii > Cc: rgm@gnu.org, 17036@debbugs.gnu.org, schwab@linux-m68k.org, rrt@sc3d.org > > > 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 And one more: . my reading of the code in 'main' is that the argv[] array is sorted as it is processed, so the restarted Emacs will get the arguments in a different order (not that it should matter too much, I think, but still: it isn't exactly the same invocation)