From 3cc6d46aee79de51fe5017251a126725c72ceba5 Mon Sep 17 00:00:00 2001
From: William Deegan <bill@baddogconsulting.com>
Date: Tue, 4 Apr 2017 11:50:54 -0400
Subject: py2/3 ensure strings sent to process are bytes on win32. This fixes
 most fo the Interactive tests

---
 QMTest/TestCmd.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py
index d9f59c0..2c0c0d3 100644
--- a/QMTest/TestCmd.py
+++ b/QMTest/TestCmd.py
@@ -736,8 +736,20 @@ class Popen(subprocess.Popen):
         getattr(self, which).close()
         setattr(self, which, None)
 
+
+    def to_bytes (s):
+        if isinstance (s, bytes) or bytes is str:
+            return s
+        return bytes (s, 'utf-8')
+
+    def to_str (s):
+        if bytes is str or is_String(s):
+            return s
+        return str (s, 'utf-8')
+
     if sys.platform == 'win32':# and subprocess.mswindows:
         def send(self, input):
+            input = to_bytes(input)
             if not self.stdin:
                 return None
 
-- 
cgit v0.12