Example #1
0
def pipe_server():
  ''' Part of attach/set_attach for Windows '''
  while 1:
    pipe = Pipe('vdb_%d' % os.getpid(), server=True)
    knock = pipe.read(3)
    if knock == 'vsi':
      os.kill(0, signal.CTRL_C_EVENT)      
      #ctypes.windll.kernel32.GenerateConsoleCtrlEvent(0, os.getpid())
    pipe.disconnect()
    pipe.close()
Example #2
0
def attach(pid):
  ''' Trigger a python pid that's been already run set_attach
  
      This is the second part of attaching to a python process. Once 
      set_attach is run, on another prompt running attach will trigger
      the interrupt thing attaching or triggering whatever db_cmd was'''
  if os.name == 'nt':
    pipe = Pipe('vdb_%d' % pid)
    pipe.write('vsi')
    pipe.close()
  else:
    os.kill(pid, ATTACH_SIGNAL)
Example #3
0
 def server(self):
   pipe = Pipe('test_named_pipes', server=True)
   self.assertEqual(pipe.read(), 'clientToServer')
   pipe.write('serverToClient')
   pipe.close()