lua-users home
lua-l archive

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

Hi all,

My UMENU program (perl version) can run a program in the background like this:

./ command_to_be_run_in_background

Here's the code of
#!/usr/bin/perl -w
use strict;

use POSIX qw(setsid);

sub launch(@) {
    my(@args) = @_;
    unless (fork) {
        setsid;             # set child process to new session
        unless (fork) {     # Create a grandchild
            close STDIN;    # close std files
            close STDOUT;
            close STDERR;
            exec @args;     # exec the x program


In my Lua readings I haven't come across a fork() command. Is there a way I 
can rewrite my in Lua? If not, is there a different way to do it in 
Lua? If not that, I spoze I could do it in C and make sure it's statically 
compiled so as to be distributable as a binary.

Anyway, anyone know how to do this in Lua?



Steve Litt
Recession Relief Package