Infinite loop not working DMD2

Guillermo Estrada phrzn at live.com
Thu Jun 2 09:42:26 PDT 2011


== Quote from Jonathan M Davis (jmdavisProg at gmx.com)'s article
> 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 loo
> ks
> 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 t
> o
> 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

Johnathan, just yesterday I was at github checking exactly the same
thing, spawnvp() is not documented and still on development, but it
seems it just call the underlying std.c.process.spawnvp function,
either way, spawnvp in either P_NOWAIT or P_NOWAITO modes will spawn
child process... so killing the father is the case of calling
system(args[]) but I'll have to test it. Thnx for the ideas.


More information about the Digitalmars-d-learn mailing list