This commit is contained in:
Viktor Szakats 2026-06-13 00:22:31 +02:00
parent 7aa55663c3
commit 1ff63dde7d
No known key found for this signature in database
10 changed files with 38 additions and 38 deletions

View file

@ -136,7 +136,7 @@ sub pidexists {
} else {
my $filter = "PID eq $pid";
# https://ss64.com/nt/tasklist.html
my $result = `tasklist -fi \"$filter\" 2>$dev_null`;
my $result = qx(tasklist -fi \"$filter\" 2>$dev_null);
if(index($result, $pid) != -1) {
return -$pid;
}
@ -170,12 +170,12 @@ sub pidterm {
Win32::Process::KillProcess($pid, 0);
} else {
# https://ss64.com/nt/tasklist.html
my $result = `tasklist -v -fo list -fi "PID eq $pid" 2>&1`;
my $result = qx(tasklist -v -fo list -fi "PID eq $pid" 2>&1);
$result =~ s/\r//g;
$result =~ s/\n/ | /g;
print "Task info for $pid before taskkill: '$result'\n";
$result = `powershell -Command "Get-CimInstance -ClassName Win32_Process -Filter 'ParentProcessId=$pid' | Select ProcessId,ParentProcessId,Name,CommandLine"`;
$result = qx(powershell -Command "Get-CimInstance -ClassName Win32_Process -Filter 'ParentProcessId=$pid' | Select ProcessId,ParentProcessId,Name,CommandLine");
$result =~ s/\r//g;
print "Task child processes for $pid before taskkill:\n";
print "$result\n";
@ -221,12 +221,12 @@ sub pidkill {
Win32::Process::KillProcess($pid, 0);
} else {
# https://ss64.com/nt/tasklist.html
my $result = `tasklist -v -fo list -fi "PID eq $pid" 2>&1`;
my $result = qx(tasklist -v -fo list -fi "PID eq $pid" 2>&1);
$result =~ s/\r//g;
$result =~ s/\n/ | /g;
print "Task info for $pid before taskkill: '$result'\n";
$result = `powershell -Command "Get-CimInstance -ClassName Win32_Process -Filter 'ParentProcessId=$pid' | Select ProcessId,ParentProcessId,Name,CommandLine"`;
$result = qx(powershell -Command "Get-CimInstance -ClassName Win32_Process -Filter 'ParentProcessId=$pid' | Select ProcessId,ParentProcessId,Name,CommandLine");
$result =~ s/\r//g;
print "Task child processes for $pid before taskkill:\n";
print "$result\n";