You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
#!/usr/bin/perl -w
|
|
$pid = fork();
|
|
|
|
if ($pid == 0) {
|
|
print "In child.\n";
|
|
exit(0); # Terminate child.
|
|
} elsif (! defined $pid) {
|
|
# Not defined: means an error.
|
|
} else {
|
|
# Parent process.
|
|
|
|
sleep(5); # Wait
|
|
|
|
$status = waitpid($pid, 0);
|
|
|
|
print "Child is dead with PID $status.\n";
|
|
} |