B
bxb7668
From my perl script I need to be able to launch (fork?) an editor
(notepad on Windows and nedit on UNIX). (Easy so far.) I need the
script to processing and the editor to keep editing totally
independent of each other. The script can end and the editor will stay
open. The editor can be closed and the script will keep running.
Reading up on fork gave me this:
#!/usr/bin/perl
FORK: {
if ($pid = fork) {
$I = 1;
while ( 1 ) {
print "hi $I\n";
sleep 1;
$I++;
}
}elsif (defined $pid) {
exec "nedit junk.txt";
}elsif ( $! =~ /no more process/) {
sleep 5;
redo FORK;
}else {
die "Can't fork";
}
}
When I close the child nedit process, the parent keeps going. But when
I close the parent with a Ctrl+C, it also kills the nedit window. Is
what I'm trying for possible? If so, how?
Thank you,
Brian
(notepad on Windows and nedit on UNIX). (Easy so far.) I need the
script to processing and the editor to keep editing totally
independent of each other. The script can end and the editor will stay
open. The editor can be closed and the script will keep running.
Reading up on fork gave me this:
#!/usr/bin/perl
FORK: {
if ($pid = fork) {
$I = 1;
while ( 1 ) {
print "hi $I\n";
sleep 1;
$I++;
}
}elsif (defined $pid) {
exec "nedit junk.txt";
}elsif ( $! =~ /no more process/) {
sleep 5;
redo FORK;
}else {
die "Can't fork";
}
}
When I close the child nedit process, the parent keeps going. But when
I close the parent with a Ctrl+C, it also kills the nedit window. Is
what I'm trying for possible? If so, how?
Thank you,
Brian