help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature request: Expose system `exec` as a built-in elisp function


From: Emanuel Berg
Subject: Re: Feature request: Expose system `exec` as a built-in elisp function
Date: Wed, 13 Aug 2014 20:45:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Andrew Pennebaker <andrew.pennebaker@gmail.com> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]