This is an automated email from Gerrit. Marc Schink ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/5189
-- gerrit commit 75cf40db8b69447d3ef6cf93b2f797d952d8c5bc Author: Marc Schink <[email protected]> Date: Mon May 20 18:14:46 2019 +0200 contrib/rpc_examples: Add (dis)connect methods Add these methods such that the OpenOcd class can also be used outside of a 'with' statement. Change-Id: I927c93fff2dc05cc74daa56360a7262e736a639f Signed-off-by: Marc Schink <[email protected]> diff --git a/contrib/rpc_examples/ocd_rpc_example.py b/contrib/rpc_examples/ocd_rpc_example.py index b585aaa..ef8e982 100755 --- a/contrib/rpc_examples/ocd_rpc_example.py +++ b/contrib/rpc_examples/ocd_rpc_example.py @@ -49,10 +49,16 @@ class OpenOcd: self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) def __enter__(self): - self.sock.connect((self.tclRpcIp, self.tclRpcPort)) + self.connect() return self def __exit__(self, type, value, traceback): + self.disconnect() + + def connect(self): + self.sock.connect((self.tclRpcIp, self.tclRpcPort)) + + def disconnect(self): try: self.send("exit") finally: -- _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
