Remove getppid script
This commit is contained in:
@@ -1,45 +0,0 @@
|
|||||||
from ctypes import *
|
|
||||||
from ctypes.wintypes import *
|
|
||||||
import win32process
|
|
||||||
|
|
||||||
|
|
||||||
class PROCESSENTRY32(Structure):
|
|
||||||
_fields_ = (
|
|
||||||
('dwSize', DWORD,),
|
|
||||||
('cntUsage', DWORD,),
|
|
||||||
('th32ProcessID', DWORD,),
|
|
||||||
('th32DefaultHeapID', POINTER(ULONG),),
|
|
||||||
('th32ModuleID', DWORD,),
|
|
||||||
('cntThreads', DWORD,),
|
|
||||||
('th32ParentProcessID', DWORD,),
|
|
||||||
('pcPriClassBase', LONG,),
|
|
||||||
('dwFlags', DWORD,),
|
|
||||||
('szExeFile', c_char * MAX_PATH,),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def getppid(pid):
|
|
||||||
"""the Windows version of os.getppid"""
|
|
||||||
pe = PROCESSENTRY32()
|
|
||||||
pe.dwSize = sizeof(PROCESSENTRY32)
|
|
||||||
|
|
||||||
snapshot = windll.kernel32.CreateToolhelp32Snapshot(2, 0)
|
|
||||||
try:
|
|
||||||
if not windll.kernel32.Process32First(snapshot, byref(pe)):
|
|
||||||
raise WindowsError
|
|
||||||
while pe.th32ProcessID != pid:
|
|
||||||
if not windll.kernel32.Process32Next(snapshot, byref(pe)):
|
|
||||||
raise WindowsError
|
|
||||||
result = pe.th32ParentProcessID
|
|
||||||
finally:
|
|
||||||
windll.kernel32.CloseHandle(snapshot)
|
|
||||||
|
|
||||||
if result not in win32process.EnumProcesses():
|
|
||||||
result = 1
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
|
||||||
if not hasattr(os, 'getppid'):
|
|
||||||
os.getppid = getppid
|
|
||||||
@@ -12,12 +12,9 @@ import time
|
|||||||
import traceback
|
import traceback
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
||||||
if os.name == 'nt':
|
|
||||||
import getppid
|
|
||||||
|
|
||||||
|
|
||||||
log = CPLog(__name__)
|
log = CPLog(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Core(Plugin):
|
class Core(Plugin):
|
||||||
|
|
||||||
ignore_restart = ['Core.crappyRestart', 'Core.crappyShutdown']
|
ignore_restart = ['Core.crappyRestart', 'Core.crappyShutdown']
|
||||||
|
|||||||
Reference in New Issue
Block a user