Aplication Process never Terminates on each run

Posted by rockyurock on Stack Overflow See other posts from Stack Overflow or by rockyurock
Published on 2010-04-03T14:20:40Z Indexed on 2010/04/03 14:23 UTC
Read the original article Hit count: 383

Filed under:
|

i am seeing an application always remains live even after closing the application using my below perl script.Also for the subsequent runs it always says that "The process cannot access the file because it is being used by another process.iperf.exe -u -s -p 5001 successful. Output was:"

so everytime i have to change the file name $file used in script or i have to kill the iperf.exe process in the Task Manager.

could anybody please let me know the way to get rid of it ?

Here is the Code i am using ...

my @command_output;
eval { 
    my $file = "abc6.txt";    
    $command = "iperf.exe -u -s -p 5001";
    alarm 10;
    system("$command > $file");
    alarm 0;
close $file;
};
if ($@) {
    warn "$command timed out.\n";
} else {
   print "$command successful. Output was:\n", $file;
}
unlink $file;

/rocky

© Stack Overflow or respective owner

Related posts about perl

Related posts about Windows