Why are the exec* functions deprecated in std.process?

Vladimir Panteleev vladimir at thecybershadow.net
Tue Oct 29 11:34:11 PDT 2013


On Tuesday, 29 October 2013 at 03:44:37 UTC, Andrei Alexandrescu 
wrote:
> There is no convenient function to replace the running process 
> with a new one. There used to be the exec() family of 
> functions, which conveniently use string[] for arguments etc., 
> but now the doc says:

In addition to what Lars said, I'd like to add that replacing the 
current process is a rather platform-dependent trick. While 
process creation in POSIX is done by forking then replacing the 
forked process with a new one, on Windows it's the other way 
around - created processes are always isolated from the current 
one, and Windows implementations of this function simply emulate 
the behavior by creating a new process, then terminating the 
current one.

I believe one of the goals of designing the new std.process is to 
create an interface that would be as platform-independent as 
possible. This meant that platform-specific functionality (which, 
incidentally, seems to be rarely used in practice) was abstracted 
away or scheduled for removal, delegating the task to such 
platform-specific (= low-level) tasks to C bindings in std.c.*, 
core.sys.* and core.stdc.*.


More information about the Digitalmars-d mailing list