command=r'''for /F "skip=2 tokens=2 delims=," %a in ('wmic process where "commandline like '%remote\\job.py%'" get processid^,status /format:csv') do taskkill /F /T /pid %a'''
kill_process('remote/job.py')
os.popen(command).read()
kill_process('remote/monitor.py')
command=r'''for /F "skip=2 tokens=2 delims=," %a in ('wmic process where "commandline like '%remote\\start.py%'" get processid^,status /format:csv') do taskkill /F /pid %a'''
os.popen(command).read()
command=r'''for /F "skip=2 tokens=2 delims=," %a in ('wmic process where "commandline like '%remote\\monitor.py%'" get processid^,status /format:csv') do taskkill /F /pid %a'''
"""kill process whose execution commnad is matched by regex pattern
Args:
regex_pattern(string): regex pattern used to filter the process to be killed
NOTE:
In windows, we will replace sep `/` with `\\\\`
"""
if_IS_WINDOWS:
regex_pattern=regex_pattern.replace('/','\\\\')
command=r'''for /F "skip=2 tokens=2 delims=," %a in ('wmic process where "commandline like '%{}%'" get processid^,status /format:csv') do taskkill /F /T /pid %a'''.format(