From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Starting a subprocess in stopped state Date: Sat, 06 May 2017 10:58:22 +0300 Message-ID: <83bmr6fmch.fsf@gnu.org> References: <831ss7hyh0.fsf@gnu.org> <83tw4zg3rj.fsf@gnu.org> <87bmr6wngl.fsf@zigzag> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1494057543 16741 195.159.176.226 (6 May 2017 07:59:03 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 6 May 2017 07:59:03 +0000 (UTC) Cc: Daiki Ueno To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 06 09:58:59 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d6ucF-0004Ep-48 for ged-emacs-devel@m.gmane.org; Sat, 06 May 2017 09:58:59 +0200 Original-Received: from localhost ([::1]:50403 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6ucK-0000PA-Hf for ged-emacs-devel@m.gmane.org; Sat, 06 May 2017 03:59:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6ucC-0000P1-Ns for emacs-devel@gnu.org; Sat, 06 May 2017 03:58:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6ucB-0001br-UL for emacs-devel@gnu.org; Sat, 06 May 2017 03:58:56 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6uc2-0001ak-8i; Sat, 06 May 2017 03:58:46 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1982 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1d6uc1-0004uT-HN; Sat, 06 May 2017 03:58:45 -0400 In-reply-to: <87bmr6wngl.fsf@zigzag> (message from Thien-Thi Nguyen on Sat, 06 May 2017 07:42:18 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:214605 Archived-At: > From: Thien-Thi Nguyen > Date: Sat, 06 May 2017 07:42:18 +0200 > > I see the docstring for ‘make-process’ says: > > :stop BOOL -- Start process in the ‘stopped’ state if BOOL > non-nil. In the stopped state, a process does not accept > incoming data, but you can send outgoing data. The stopped > state is cleared by ‘continue-process’ and set by > ‘stop-process’. > > My understanding is that "stopped state", given that "you can > send outgoing data", is an Emacs-internal data routing concern > rather than an OS-level concern (SIGTSTP). The latter would > completely prevent the asymmetric data feature (documented by > "you can send outgoing data"), i'd think. However, stop-process does send SIGTSTP to the process, and continue-process sends SIGCONT. The above means that the process started with :stop non-nil will indeed run, unlike a process which was stopped with stop-process immediately after starting it. So there are two flavors of "stopped" state here, one with SIGTSTP delivered to the process, the other without. Also, not reading the Emacs end of the pipe, while the process runs is probably going to get is to undefined behavior in some situations, especially with multithreaded processes. For network or serial or pipe "process", not reading from the descriptor is all that counts. But for a local subprocess, this is not so, IMO. Is there a way to create a process on Unix and GNU systems, but prevent it from running until it gets SIGCONT or something similar? (There is such a way on MS-Windows.) Debuggers do that, of course, but I don't mean starting a process as a debugger would, since that would be gross, and probably requires special privileges at least on some systems. Thanks.