From 75dba75fbb78ce31c3affc57f24fb576c9a65ccb Mon Sep 17 00:00:00 2001
From: Alexandre Abadie <alexandre.abadie@inria.fr>
Date: Tue, 17 Apr 2018 17:09:36 +0200
Subject: [PATCH] dist/tools/pyterm: handle ctrl+d nicely

---
 dist/tools/pyterm/pyterm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dist/tools/pyterm/pyterm b/dist/tools/pyterm/pyterm
index 174a1022dd..72762cfc0c 100755
--- a/dist/tools/pyterm/pyterm
+++ b/dist/tools/pyterm/pyterm
@@ -288,6 +288,12 @@ class SerCmd(cmd.Cmd):
         """
         self.ser.write("help\n".encode("utf-8"))
 
+    def do_EOF(self, line):
+        """Handle EOF (Ctrl+D) nicely."""
+        self.logger.debug("Received EOF")
+        self.do_PYTERM_exit("")
+        sys.exit(0)
+
     def complete_date(self, text, line, begidx, endidm):
         """Auto completion for date string.
         """
-- 
GitLab