www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Fix for the linux spawnvp link bug

Index: src/phobos/std/process.d
===================================================================
--- src/phobos/std/process.d	(revision 5)
+++ src/phobos/std/process.d	(working copy)
   -49,13 +49,15   
 
 /* ========================================================== */
 
-int spawnvp(int mode, char[] pathname, char[][] argv)
-{
-    char** argv_ = cast(char**)alloca((char*).sizeof * (1 + argv.length));
+version(Windows) {
+    int spawnvp(int mode, char[] pathname, char[][] argv)
+    {
+        char** argv_ = cast(char**)alloca((char*).sizeof * (1 + argv.length));
 
-    toAStringz(argv, argv_);
+        toAStringz(argv, argv_);
 
-    return std.c.process.spawnvp(mode, toStringz(pathname), argv_);
+        return std.c.process.spawnvp(mode, toStringz(pathname), argv_);
+    }
 }
 
 /* ========================================================== */
Index: src/phobos/std/c/process.d
===================================================================
--- src/phobos/std/c/process.d	(revision 5)
+++ src/phobos/std/c/process.d	(working copy)
   -18,14 +18,16   
 
 int system(char *);
 
-int spawnl(int, char *, char *,...);
-int spawnle(int, char *, char *,...);
-int spawnlp(int, char *, char *,...);
-int spawnlpe(int, char *, char *,...);
-int spawnv(int, char *, char **);
-int spawnve(int, char *, char **, char **);
-int spawnvp(int, char *, char **);
-int spawnvpe(int, char *, char **, char **);
+version(Windows) {
+    int spawnl(int, char *, char *,...);
+    int spawnle(int, char *, char *,...);
+    int spawnlp(int, char *, char *,...);
+    int spawnlpe(int, char *, char *,...);
+    int spawnv(int, char *, char **);
+    int spawnve(int, char *, char **, char **);
+    int spawnvp(int, char *, char **);
+    int spawnvpe(int, char *, char **, char **);
+}
 
 
 enum { _P_WAIT, _P_NOWAIT, _P_OVERLAY };
   -57,21 +59,23   
 void _endthreadex(uint);
 
 
-int _wsystem(wchar_t *);
-int _wspawnl(int, wchar_t *, wchar_t *, ...);
-int _wspawnle(int, wchar_t *, wchar_t *, ...);
-int _wspawnlp(int, wchar_t *, wchar_t *, ...);
-int _wspawnlpe(int, wchar_t *, wchar_t *, ...);
-int _wspawnv(int, wchar_t *, wchar_t **);
-int _wspawnve(int, wchar_t *, wchar_t **, wchar_t **);
-int _wspawnvp(int, wchar_t *, wchar_t **);
-int _wspawnvpe(int, wchar_t *, wchar_t **, wchar_t **);
+version(Windows) {
+    int _wsystem(wchar_t *);
+    int _wspawnl(int, wchar_t *, wchar_t *, ...);
+    int _wspawnle(int, wchar_t *, wchar_t *, ...);
+    int _wspawnlp(int, wchar_t *, wchar_t *, ...);
+    int _wspawnlpe(int, wchar_t *, wchar_t *, ...);
+    int _wspawnv(int, wchar_t *, wchar_t **);
+    int _wspawnve(int, wchar_t *, wchar_t **, wchar_t **);
+    int _wspawnvp(int, wchar_t *, wchar_t **);
+    int _wspawnvpe(int, wchar_t *, wchar_t **, wchar_t **);
 
-int _wexecl(wchar_t *, wchar_t *, ...);
-int _wexecle(wchar_t *, wchar_t *, ...);
-int _wexeclp(wchar_t *, wchar_t *, ...);
-int _wexeclpe(wchar_t *, wchar_t *, ...);
-int _wexecv(wchar_t *, wchar_t **);
-int _wexecve(wchar_t *, wchar_t **, wchar_t **);
-int _wexecvp(wchar_t *, wchar_t **);
-int _wexecvpe(wchar_t *, wchar_t **, wchar_t **);
+    int _wexecl(wchar_t *, wchar_t *, ...);
+    int _wexecle(wchar_t *, wchar_t *, ...);
+    int _wexeclp(wchar_t *, wchar_t *, ...);
+    int _wexeclpe(wchar_t *, wchar_t *, ...);
+    int _wexecv(wchar_t *, wchar_t **);
+    int _wexecve(wchar_t *, wchar_t **, wchar_t **);
+    int _wexecvp(wchar_t *, wchar_t **);
+    int _wexecvpe(wchar_t *, wchar_t **, wchar_t **);
+}
Jan 07 2006