def _is_pid_running_on_windows(pid):
 pid = str(pid)
 startupinfo = subprocess.STARTUPINFO()
 startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
 process = subprocess.Popen('tasklist /fi "PID eq {0}"'.format(pid), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, startupinfo=startupinfo)
 (stdoutdata, stderrdata) = process.communicate()
 stdoutdata = to_text_string(stdoutdata)
 process.kill()
 check = (pid in stdoutdata)
 return check

def _is_pid_running_on_windows ( pid ) : pid = str ( pid ) startupinfo = subprocess . STARTUPINFO ( ) startupinfo . dwFlags |= subprocess . STARTF_USESHOWWINDOW process = subprocess . Popen ( 'tasklist /fi "PID eq {0}"' . format ( pid ) , stdout = subprocess . PIPE , stderr = subprocess . STDOUT , startupinfo = startupinfo ) ( stdoutdata , stderrdata ) = process . communicate ( ) stdoutdata = to_text_string ( stdoutdata ) process . kill ( ) check = ( pid in stdoutdata ) return check
check if a process is running on windows systems based on the pid .