1
即使在使用下面的Perl脚本关闭应用程序后,我仍然看到应用程序始终保持有效。另外,对于后续的运行,它总是说:“进程无法访问该文件,因为它正在被另一进程使用。iperf.exe -u -s -p 5001成功。输出为:”应用程序进程永不终止每次运行
因此,每次我必须更改脚本中使用的文件名$文件,或者我必须在任务管理器中杀掉iperf.exe进程。
有没有人请让我知道摆脱它的方式?
这里是我使用的代码...
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 ([email protected]) {
warn "$command timed out.\n";
} else {
print "$command successful. Output was:\n", $file;
}
unlink $file;
该进程“iperf.exe”旨在用于contd .. time,但由于运行该应用程序的作业已完成,因此我在10秒后进行超时。 但因为我想一次又一次运行该应用程序,所以我想杀(某种摆脱做手动杀死Taskmanager或改变文件名再次和再次) 所以我想知道杀死该进程的方式按窗口中的应用程序名称 /rocky – user285686 2010-04-03 15:49:57