Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
 ryu/app/debug_console.py | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 ryu/app/debug_console.py

diff --git a/ryu/app/debug_console.py b/ryu/app/debug_console.py
new file mode 100644
index 0000000..ab9d3a2
--- /dev/null
+++ b/ryu/app/debug_console.py
@@ -0,0 +1,37 @@
+# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
+# Copyright (C) 2013 YAMAMOTO Takashi <yamamoto at valinux co jp>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# a RyuApp to provide a python interactive console for debugging
+
+import code
+import gevent
+import os
+import sys
+import signal
+
+from ryu.base import app_manager
+
+
+class DebugConsole(app_manager.RyuApp):
+    def __init__(self, *args, **kwargs):
+        super(DebugConsole, self).__init__(*args, **kwargs)
+        gevent.spawn(self.__thread)
+
+    def __thread(self):
+        code.InteractiveConsole().interact("Ryu Debug Console")
+
+        # XXX should be a graceful shutdown
+        os.kill(os.getpid(), signal.SIGTERM)
-- 
1.8.0.1


------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to