Comment #0 by golovanov_alexey — 2009-07-09T05:17:44Z
Phobos in DMD 2.031, 2.030, 1.045 on Windows XP SP3:
function int std.process.execv(in string pathname, in immutable(char)[][] argv)
not return any value, but terminate application.
Short example - caller.exe should run called.exe, then print returned value:
/*** begin file caller.d */
import std.process;
import std.stdio;
void main()
{
string[] args = ["a1", "b2", "c3"];
int res = std.process.execv("called.exe", args);
writefln("res=%d", res); /*this line never executed*/
}/*** end file caller.d */
In Windiws XP environment caller.exe terminates with code 0 while executing execv() function, and writefln() never executed - no any output occure;
Under debug we can see calls:
_Dmain -> std@process@execv -> _execv -> ___spawn -> sub_4263F0 -> _exec -> _exit
Comment #1 by shro8822 — 2009-07-09T07:41:41Z
This is spec is almost certainly wrong because the POSIX exec* calls replace the current process with whatever it is called with, The function never returns unless something goes wrong. These functions should be renamed or re speced.
Comment #2 by witold.baryluk+d — 2009-07-13T03:07:14Z
exec* calls bahaves this way. So IMHO documentation should be fixed.
Comment #3 by mk — 2013-04-01T14:11:22Z
Sorry, accidentally closed, reopening.
Comment #4 by jack — 2015-12-16T02:04:45Z
This is documented in the current version.
All bugs on Phobos and DMD related to D1 were closed, so I think it's prudent to do so here as well. D does not have the man power to fix doc issues in older versions.