def run(self):
	try:
	    stop = 0
	    while not stop:
		try:
		    while not stop:
			    conn = self.connection
			    self.prompt = conn.prompt
                            if conn is not self.monitor_connection:
                                conn.exec_cmd(cmd=None,noblock=1)
			    cmd = raw_input(conn.prompt)
			    self.prompt = None
			    conn = None
			    if cmd.startswith('.'):
				if cmd == '.':
				    self.connection = self.monitor_connection
				else:
				    cmd = cmd[1:]
				    conn = self.monitor_connection
                            #elif cmd or self.connection is self.monitor_connection:
                            else:
				conn = self.connection
			    if conn:
				try:
				    r = conn.exec_cmd(cmd)
				except EOFError:
				    r = 1
				if conn is self.monitor_connection and r:
				    stop = 1
				    #print 'to stop'
		    #print 'end of loop'
		except EOFError:
                    'We better exit in case the input is from a file'
		    #print 'EOFError'
		    #print 'Use the monitor q command to quit.'
                    print '*** End Of File - Exiting Monitor ***'
		    self.connection = self.monitor_connection
                    stop = 1
		except __HOLE__:
		    print 'KeyboardInterrupt'
                    print 'Use the ki command to interrupt a remote process.'
		    self.connection = self.monitor_connection
		    continue
		
	finally:
            self.prompt=None # Avoid closing messages
	    #print 'to close'
	    self.close()
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/guppy-0.1.10/guppy/heapy/Monitor.py/Monitor.run