gitso

gitso Commit Details


Date:2009-05-18 22:27:16 (15 years 7 months ago)
Author:gerberad
Branch:master
Commit:f3d8670704609061960b954edb580f7e2c8b8a0e
Parents: 5da5acf6ab8c333bbc9868b61506e0df4b02efad
Message:/trunk/Processes.py Troy's code to kill VNC processes. Hasn't been tested in windows yet.

Changes:

File differences

gitso/trunk/Processes.py
3838
3939
4040
41
41
42
4243
4344
4445
45
46
4647
4748
4849
......
5354
5455
5556
56
57
5758
58
59
5960
6061
6162
......
7071
7172
7273
73
74
75
76
74
75
76
77
78
79
7780
7881
79
82
8083
8184
elif sys.platform.find('linux') != -1:
self.returnPID = os.spawnlp(os.P_NOWAIT, 'x11vnc', 'x11vnc','-nopw','-ncache','20','-solid','black','-connect','%s' % host)
elif sys.platform == 'win32':
self.returnPID = os.spawnl(os.P_NOWAIT, 'WinVNC.exe', 'WinVNC.exe')
import subprocess
self.returnPID = subprocess.Popen(['WinVNC.exe'])
print "Launched WinVNC.exe, waiting to run -connect command..."
import time
time.sleep(3)
self.returnPID = os.spawnl(os.P_NOWAIT, 'WinVNC.exe', 'WinVNC.exe', '-connect', '%s' % host)
subprocess.Popen(['WinVNC.exe', '-connect', '%s' % host])
else:
print 'Platform not detected'
return self.returnPID
print vncviewer
self.returnPID = os.spawnlp(os.P_NOWAIT, vncviewer, vncviewer, '--listen')
elif sys.platform.find('linux') != -1:
self.returnPID = os.spawnlp(os.P_NOWAIT, 'vncviewer', 'vncviewer', '-listen')
self.returnPID = os.spawnlp(os.P_NOWAIT, 'vncviewer', 'vncviewer', '-bgr233', '-listen')
elif sys.platform == 'win32':
self.returnPID = os.spawnl(os.P_NOWAIT, "vncviewer.exe" , 'vncviewer.exe' , '-listen' )
self.returnPID = subprocess.Popen(['vncviewer.exe' , '-listen'])
else:
print 'Platform not detected'
return self.returnPID
if self.returnPID != 0:
print "Processes.KillPID(" + str(self.returnPID) + ")"
if sys.platform == 'win32':
#import win32api
#handle = win32api.OpenProcess(1, 0, pid)
#return (0 != win32api.TerminateProcess(handle, 0))
print "windows doesn't kill processes yet"
import win32api
PROCESS_TERMINATE = 1
handle = win32api.OpenProcess(PROCESS_TERMINATE, False, self.returnPID.pid)
win32api.TerminateProcess(handle, -1)
win32api.CloseHandle(handle)
print "vnc is dead, handles closed."
else:
os.kill(self.returnPID, signal.SIGKILL)
self.returnPID = 0
self.returnPID = 0
return

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.06374s using 13 queries.