public static boolean isWindowsProcessAlive ( InstanceConfiguration config , String pid ) { CommandLine command = new CommandLine ( "tasklist" ) . addArgument ( "/FI" ) . addArgument ( "PID eq " + pid , true ) ; List < String > output = executeScript ( config , command , true ) ; String keyword = String . format ( " %s " , pid ) ; boolean isRunning = output . stream ( ) . anyMatch ( s -> s . contains ( keyword ) ) ; return isRunning ; }
Check if the process with the given PID is running or not . This method only handles processes running on Windows .