Skip to content

Commit

Permalink
Replaced deprecated wmic with powershell command to getPid
Browse files Browse the repository at this point in the history
WMIC is deprecated in the latest Windows versions, causing issues in retrieving process IDs. This update switches to PowerShell-based commands for future support

Related : runtimes/automation/issues/185

Signed-off-by: Amrutha Kanhirathingal <[email protected]>
  • Loading branch information
Amrutha-Kanhirathingal committed Feb 14, 2025
1 parent 28c9282 commit c7910e4
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
open3($in, $out, $err, $javaCmd);
$javaPid = <$out>;
# Command gets the list of PIDs of the Java processes system is running
$perlPid = `wmic process where "name='java.exe'" get ProcessID`;
$perlPid = `powershell -Command "& { Get-Process java | Select-Object -ExpandProperty Id }"`;
print $in "getPid finished";
# String trim both sides of javaPid and perlPid for the index check
$javaPid =~ s/^\s+|\s+$//g;
Expand Down

0 comments on commit c7910e4

Please sign in to comment.