From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andrew Pennebaker Newsgroups: gmane.emacs.help Subject: Re: Feature request: Expose system `exec` as a built-in elisp function Date: Wed, 13 Aug 2014 13:48:44 -0500 Message-ID: References: <87mwb8tej5.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1407955746 1470 80.91.229.3 (13 Aug 2014 18:49:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Aug 2014 18:49:06 +0000 (UTC) Cc: Emacs Help To: Emanuel Berg Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 13 20:49:01 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XHdbY-0003Br-43 for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Aug 2014 20:49:00 +0200 Original-Received: from localhost ([::1]:49596 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHdbX-0000rA-Ih for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Aug 2014 14:48:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51548) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHdbK-0000r1-7D for help-gnu-emacs@gnu.org; Wed, 13 Aug 2014 14:48:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XHdbI-0007ED-US for help-gnu-emacs@gnu.org; Wed, 13 Aug 2014 14:48:46 -0400 Original-Received: from mail-ig0-x234.google.com ([2607:f8b0:4001:c05::234]:36137) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHdbI-0007E8-Na for help-gnu-emacs@gnu.org; Wed, 13 Aug 2014 14:48:44 -0400 Original-Received: by mail-ig0-f180.google.com with SMTP id l13so2677137iga.7 for ; Wed, 13 Aug 2014 11:48:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=X473A7Q+Dl9qn6TM4xu/TT6YxMb9aE8AbIO0wNrHnpc=; b=KQmtdVqavEFPE5QQTUt8CbcmKUrMInl9i38PAeyV1ujymGLShn4J/qp0MrkIWGQr3L 6aqog5wPsk9vQ3Q5S5nbr9xfquDSCxIwKBdxmAU6kwxU21JIST2eIP4tPRl6ENmoXhZZ rWItHrSCNMz/8jr3q686TPzaiOBDU+FhY8KZsUJ8vviP+2juGK8VJKaKSC73CtiEg97F jztW8e/cJ18tyUDMrBHzn30OvGeWzOOkWCJOCuoaCi+tYSDgZAIou6BxfQGtaRyrm/AB zZkQ+CnTsWjMqzOY1GnjLI3hiToXWTbKn+RBnUvnyZe31D6KyHuE8JmnDnEB8H1TwbqJ BHKw== X-Received: by 10.50.25.41 with SMTP id z9mr10462954igf.0.1407955724150; Wed, 13 Aug 2014 11:48:44 -0700 (PDT) Original-Received: by 10.43.172.3 with HTTP; Wed, 13 Aug 2014 11:48:44 -0700 (PDT) In-Reply-To: <87mwb8tej5.fsf@debian.uxu> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4001:c05::234 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:99191 Archived-At: One example of the worthiness of exec is cask, an Emacs package manager that sometimes wants to fork out to an emacs instance, for editing text files. On Wed, Aug 13, 2014 at 1:45 PM, Emanuel Berg wrote: > Andrew Pennebaker writes: > > > That's what I thought, at first. exec has the > > additional semantic that it replaces the current > > process with the system call, so it's more efficient > > for certain tasks. > > Yes, exec (man "exec") does this. It accepts an > argument for what program to execute, and then a list > of arguments (the argv) to be inputed that program. > > It is usually used with fork. One process devides itself > with fork(), which returns twice (magic!), and from the > return values the child process can be identified; > then, the child uses exec to fill itself with software > so it can do something productive. > > So as for this method and setting (which may be > different from yours) it is not a matter of efficiency, > it is rather that without exec, often there isn't > anything for the child to do. (You probably already > know all this.) > > So if you want to replace the current process, can't > you just have the current process execute whatever code > you had in mind for exec? > > -- > underground experts united > -- Cheers, Andrew Pennebaker www.yellosoft.us