Infinite loop not working DMD2

Jonathan M Davis jmdavisProg at gmx.com
Thu Jun 2 09:16:55 PDT 2011


On 2011-06-02 09:14, Guillermo Estrada wrote:
> == Quote from Ali Çehreli (acehreli at yahoo.com)'s article
> 
> > On 06/02/2011 08:51 AM, Guillermo Estrada wrote:
> > >> The exec* family of functions cause the new app to replace the
> > > 
> > > current process.  So after the execv, the loop doesn't exist.
> > > 
> > > Any way to spawn the process without killing himself?
> > 
> > Would std.process.system or std.process.shell work?
> > Ali
> 
> Well, std.process.system does not wok as intended because if you
> kill the parent process all children die. std.process.shell works
> and does what it should but spawning a cmd on each request, for a
> dirty quick fork bomb well, it's the same, but there should be a way
> in phobos to spawn process and detach them or even have control over
> them and close them like in tango.sys.Process, without having to go
> to the std.c.* libs. Thnx for the help :D

Okay. I just glanced at std.process, and I'd suggest trying spawnvp. It looks 
like it ends up calling fork, so it'll probably work. I haven't tried it 
though and don't know anything about the function beyond what's in the code.

Also, just because there _should_ be a way for there to do something in 
druntime or Phobos doesn't mean that there _is_ a way. There's plenty that you 
still have to call C functions for, if nothing else because it takes time to 
add all of the relevant features, and not all of the relevant features are 
always remembered by the Phobos developers. So, if you can't find something 
that really seems like it should be in Phobos, open an enhancement request on 
it on bugzilla: d.puremagic.com/issues/

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list