[fpc-pascal] Re: Linux: How to execute a program, but not towait until finishes
Ludo Brands
ludo.brands at free.fr
Wed Jul 20 09:11:42 CEST 2011
> -----Message d'origine-----
> De : fpc-pascal-bounces at lists.freepascal.org
> [mailto:fpc-pascal-bounces at lists.freepascal.org] De la part
> de Sven Barth
> Envoyé : mardi 19 juillet 2011 20:14
> À : fpc-pascal at lists.freepascal.org
> Objet : Re: [fpc-pascal] Re: Linux: How to execute a program,
> but not towait until finishes
>
>
> On 19.07.2011 16:52, fred f wrote:
> > Hi,
> >
> > use this code, which starts itself, but when you close
> first started
> > the second ends as well, what I don't want.
> >
> > with TProcess.Create (Application) do begin
> > CommandLine := Application.ExeName + '&';
> > Execute;
> > Free;
> > end;
>
> If I remember correctly this is simply the way Unix behaves. If the
> parent process terminates all children are terminated as
> well. I don't
> know how one can circumvent this.
>
Orphans are reparented to PID 1, the init process.
Simple demonstration in a terminal
$ sh
$ gedit &
$ ps -l
You see that gedit is parented to the sh just launched.
$ exit
$ ps -l
gedit is still running but now parented to pid 1.
Ludo
More information about the fpc-pascal
mailing list