S
Steve Litt
Hi all,
My umenu program has a utility called ufork.pl, whose job it is to
run an X program in the background in such a way that even if the
process that ran it is killed, the X program continues to live. I
want to translate it to Ruby, but I can't find an equivalent to
Perl's setsid anywhere in the Kernel module. Here's the code:
#!/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
}
}
sleep(1);
}
launch(@ARGV);
=======================
Anyone know an equivalent to setsid? Anyone ever do this in Ruby
before? I think it's a fairly common riff.
Thanks
SteveT
My umenu program has a utility called ufork.pl, whose job it is to
run an X program in the background in such a way that even if the
process that ran it is killed, the X program continues to live. I
want to translate it to Ruby, but I can't find an equivalent to
Perl's setsid anywhere in the Kernel module. Here's the code:
#!/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
}
}
sleep(1);
}
launch(@ARGV);
=======================
Anyone know an equivalent to setsid? Anyone ever do this in Ruby
before? I think it's a fairly common riff.
Thanks
SteveT