in reply to Re: exec creates two processes.. how to kill them?
in thread exec creates two processes.. how to kill them?
#!/usr/bin/perl use warnings; use strict; if (-f "./testfile") { !system "rm -f testfile" or die "Couldn't delete already present testfile\n"; } my $pid; my $parent = $$; print "This is parent $parent \n"; defined($pid = fork) or die "Cannot fork: $!"; unless($pid) { print "This is child pid $$\n"; open (STDOUT, '>', 'testfile') or die "Can't create testfile: $!"; select STDOUT; $| = 1; my @cmd = qw(cat /dev/urandom); # Child process is here exec { $cmd[0] } @cmd; } sleep 1; kill 15 => $pid; wait;
|
|---|