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

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Oct 29 12:30:08 PDT 2013


On 10/29/13 11:34 AM, Vladimir Panteleev wrote:
> 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.*.

That argument doesn't seem to hold water. So if Windows does it less 
efficiently than Linux, we should... remove the option altogether so we 
level the field?

Andrei



More information about the Digitalmars-d mailing list