Re: posix_spawn

"Kirill A. Korinsky" <[email protected]>
Newsgroups gmane.lisp.gcl.devel
Message-ID <[email protected]>
something goes wrong here. It stuck like this:

loading /Users/catap/src/gcl/gcl/unixport/../cmpnew/gcl_cmpspecial.lsp
loading /Users/catap/src/gcl/gcl/unixport/../cmpnew/gcl_cmplam.lsp
loading /Users/catap/src/gcl/gcl/unixport/../cmpnew/gcl_cmplet.lsp
loading /Users/catap/src/gcl/gcl/unixport/../cmpnew/gcl_cmpvs.lsp
loading /Users/catap/src/gcl/gcl/unixport/../cmpnew/gcl_cmpwt.lsp
loading /Users/catap/src/gcl/gcl/unixport/../cmpnew/gcl_cmpmain.lsp

NIL

COMPILER>
(:SDEBUG
 :SETF :PRE-GCL :DYNAMIC-EXTENT :INTDIV :64BIT :C99 :UNEXEC
 :NATIVE-RELOC :EDITLINE :TRUNCATE_USE_C :CLX-LITTLE-ENDIAN :BSD
 :DARWIN21.6.0 :X86_64 :IEEE-FLOATING-POINT :DARWIN :UNIX :GMP :GCL
 :AKCL :COMMON :KCL)

COMPILER>
#<"SYSTEM" package>

SYSTEM>
T

SYSTEM>

and it expect my input via keyboard.

--
wbr, Kirill

> On 22. Dec 2023, at 23:41, Camm Maguire <[email protected]> wrote:
> 
> 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			     		    [email protected]
> ==========================================================================
> "The earth is but one country, and mankind its citizens."  --  Baha'u'llah
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEE3/KLNtcfWfLw7JxqmNjZhndZIm4FAmWGGCkACgkQmNjZhndZ
Im7Zsg//Y8aFJlu7I1pVfUkIA3MzfIhsALP4RGB5vJyn4+CZQb7qA3wDFLMqW/1l
JNuZnsCGt3AU9afFXFc97bpjXP/fBsTtcE2/gyYrPk96jmHJsXvGK1AURyxiabG3
SrlsYatTcCxYfot6j0NfknBnIlQGEceD8mbtPLGYugsynT8wkmEGxKD2F/hpYZxB
sPmbUuTF3IGF52CijLqTi+KWARm7ghnbiq8QtCSrYHDHeSY0PV07S5lTcybV8jLX
nQOpDq4lFuONPWo50160ynz6S/vPNYqwIoB63lhIHJ6CSlLBfBwZibOI1sKfKpFb
Fso7/puwvVm2pi+jwEnvOtAy1WEZ0+ysbl90ebAUX2Q/0MOP5vX3Nd45SCRfMgvD
XLyhRBunaYL1oHli4wzDtDJGtZtCTOqt9gbmzHcVBtFIH6amh6SL2WQ3XbVpR8+c
3F6GZ7zrMYTsK5tpNJV8wF0cIEBPVWwuJzQH4UPrc4ctChAb/6gfm+TeiNQRivhv
R2VQYcSF+Uq21Z3CLFaXO9yrFc0LF5JE93w93Nky88xeQ5D23NFKwKJ85HlPUjPC
QpqjKirnOeK1TauH9oifWL6gba48wi9f0AZbUgIMiteeFNdzo0ocm41J6RI0zq/y
BKln09YP7BqAazQYeLs8g0JVryaFn1YcUSfhuqSbXKLOT/wvMEI=
=umiA
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.