lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi Japa,

IIRC, to remove the child process from the O.S. process table and free 
its resources you have to call posix.wait() on the parent process after 
the call to os.exit() on the child process. See the man pages for fork 
and wait functions.

If your client is waiting the server to close the connection, I think 
you have to call client:close() on the server parent process as well to 
really close the file descriptor.

Victor Fusco

On Tuesday 07 April 2009 23:14:27 Mike Panetta wrote:
> os.exit() I believe.
>
> Mike
>
> On Tue, Apr 7, 2009 at 10:11 PM, Japa <greatjapa@gmail.com> wrote:
> > pid = posix.fork()
> >     if pid == 0 then
> >
> >         local file = io.open("archive.pdf", mode)
> >         local t = file:read("*all")
> >
> >         client:send(t)
> >
> >         file:close()
> >         client:close()
> >         -- kill or exit ???
> >     end
> >
> > I'm trying to make a client-server, above is the code of server and 
when
> > i send a archive to the client, the client doesn't finish because 
some
> > reason that i don't know. That's why i trying to kill the child 
process,
> > you talk about a exit(), how can i do that? os.exit? posix.exit?
> >
> > On Tue, Apr 7, 2009 at 10:24 PM, Mike Panetta 
<panetta.mike@gmail.com>wrote:
> >> Why do you want to kill it?  Why not just exit()?
> >>
> >> Mike
> >>
> >> On Tue, Apr 7, 2009 at 9:02 PM, Japa <greatjapa@gmail.com> wrote:
> >>> Someone knows how can I kill a process in posix? I'm in a child 
process
> >>> and I want to kill this process(kill myself)
> >>>
> >>> thanks
> >>>
> >>> --
> >>> Marcelo Oikawa
> >
> > --
> > Marcelo Oikawa