# HG changeset patch
# User jfp <jf.pieronne@laposte.net>
# Date 1738652476 -3600
#      Tue Feb 04 08:01:16 2025 +0100
# Node ID 83854973a3a2007bd1746d1a5cc4e949e98b87cd
# Parent  908ca6ed8833163eaa1afe0233f043abe9592766
Add cancel method to Ptd class, close return the status of _vmsptd.delete call

diff --git a/python/local/ovms_module/ovms/ptd/__init__.py b/python/local/ovms_module/ovms/ptd/__init__.py
--- a/python/local/ovms_module/ovms/ptd/__init__.py
+++ b/python/local/ovms_module/ovms/ptd/__init__.py
@@ -240,9 +240,13 @@
             )
         Ptd.tty_typahdsz = getsyi(SYI__TTY_TYPAHDSZ)[1]
 
-    def close(self):
+    def close(self) -> int:
         """Forces the pseudoterminal to be deleted and frees the channel"""
-        _vmsptd.delete(self.ptd)
+        return _vmsptd.delete(self.ptd)
+
+    def cancel(self) -> int:
+        """Cance any I/O on channel"""
+        return _vmsptd.cancel(self.ptd)
 
     def clear_screen(self):
         """Clear the screen image"""