Pau*_*sar 4 perl sigkill kill-process
我需要使用特定的exitcode吗?
Win32::Process::Create(
$ProcessObj,
"C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe",
"firefox -no-remote -P $prof_name",
0,
NORMAL_PRIORITY_CLASS,
".")|| die ErrorReport();
$ProcessObj->kill(0);
Run Code Online (Sandbox Code Playgroud)
这样就可以杀死它,但不是轻微的,它会导致Firefox配置文件出现问题.
除了Window之外的简短常用方法taskkill
是有力的.感谢暴徒和melpomene.
该Win32::Process
文档不说什么方法Kill
或KillProcess
做什么,但他们似乎很生硬了.Windows确实提供了如何终止进程的渐变,例如,通过winapi查看关于正常终止的帖子,即使它没有UNIX的信号.但是,这显然没有被模块使用,也没有kill
(见最后).
Windows自己taskkill
应该很好地要求进程终止.通过taskkill /?
在系统的控制台中运行来查询标志.这是文档taskkill on MS technet
.例如,这会通过它$pid
及其子项终止进程
my $pid = $ProcessObj->GetProcessID();
system("taskkill /t /pid $pid");
Run Code Online (Sandbox Code Playgroud)
如果该方法GetProcessID()
未返回真实ID,请参阅以下链接以了解其他方法.
我现在无法在Windows上测试.this post
第二部分有更多相关细节.
Perl kill
在Windows上显然很有用.从perlport
...
kill($sig, $pid)
终止标识的进程$pid
,并使其退出状态立即退出$sig
.
感谢melpomene的评论和文档链接.
的exitcode
,我相信,只是告诉处理什么向系统作为其出口报告.
归档时间: |
|
查看次数: |
303 次 |
最近记录: |