gcl-devel
[Top][All Lists]
Advanced

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

posix_spawn


From: Camm Maguire
Subject: posix_spawn
Date: Fri, 22 Dec 2023 17:41:16 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Greetings!  I am exercising this patch in case you want to try it out.

modified   gcl/o/unixsys.c
@@ -32,6 +32,8 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 
 #if !defined(__MINGW32__) && !defined(__CYGWIN__)
 
+       #include <spawn.h>
+
 int
 vsystem(const char *command) {
 
@@ -58,11 +60,27 @@ vsystem(const char *command) {
 
   }
 
-  if (!(pid=pvfork())) {
-    errno=0;
-    execvp(*p1,(void *)p1);
-    _exit(128|(errno&0x7f));
+  {
+
+    posix_spawnattr_t attr;
+    posix_spawn_file_actions_t file_actions;
+    extern char **environ;
+
+    massert(!posix_spawn_file_actions_init(&file_actions));
+    massert(!posix_spawnattr_init(&attr));
+
+    massert(!posix_spawnp(&pid, *p1, &file_actions, &attr,  (void *)p1, 
environ));
+
+    massert(!posix_spawnattr_destroy(&attr));
+    massert(!posix_spawn_file_actions_destroy(&file_actions));
+
   }
+    
+  /* if (!(pid=pvfork())) { */
+  /*   errno=0; */
+  /*   execvp(*p1,(void *)p1); */
+  /*   _exit(128|(errno&0x7f)); */
+  /* } */
 
   massert(pid>0);
   massert(pid==waitpid(pid,&s,0));

Take care,
-- 
Camm Maguire                                        camm@maguirefamily.org
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah



reply via email to

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