Starting and stopping a child process in Windows

_spawn, _spawnl, _spawnle, _spawnlpe, _spawnv, _spawnve, _spawnvp,
_spawnvpe are on Windows.

I don't even think I realized Unix had a spawn function (or I forgot).
Looks like it's just a combined fork + exec.

Regards,

Dan

···

-----Original Message-----
From: nobu.nokada@softhome.net [mailto:nobu.nokada@softhome.net]
Sent: Wednesday, April 27, 2005 8:59 AM
To: ruby-talk ML
Subject: Re: Starting and stopping a child process in Windows

Hi,

At Wed, 27 Apr 2005 23:53:52 +0900,
Berger, Daniel wrote in [ruby-talk:140048]:
> > With 1.9 feature:
> >
> > $ ruby -v -e 'pid = spawn("cmd.exe"); sleep 3;
> > Process.kill("TERM", pid); puts; p Process.waitpid(pid); p $?'
> > ruby 1.9.0 (2005-04-22) [i386-cygwin]
> > Microsoft Windows 2000 [Version 5.00.2195]
> > (C) Copyright 1985-2000 Microsoft Corp.
> >
> > c:\ruby>
> > 2140
> > #<Process::Status: pid=2140,signaled(SIGTERM=15)>
>
> Which of the many flavors of spawn are you using on Win32? And how
> does it work on Unix?

Which? I just use built-in method, and it works on other
platforms almost too, except for DJGPP and a few.

Hi,

At Thu, 28 Apr 2005 00:05:08 +0900,
Berger, Daniel wrote in [ruby-talk:140051]:

> Which? I just use built-in method, and it works on other
> platforms almost too, except for DJGPP and a few.

_spawn, _spawnl, _spawnle, _spawnlpe, _spawnv, _spawnve, _spawnvp,
_spawnvpe are on Windows.

Ah, you're talking about the implementation? None of them.
See rb_w32_spawn() and CreateChild() functions in win32/win32.c
for detail.

I don't even think I realized Unix had a spawn function (or I forgot).
Looks like it's just a combined fork + exec.

Yes, it's implemented using those system calls. See
rb_spawn(), rb_fork() and rb_exec() functions in process.c.

···

--
Nobu Nakada