diff c_kernel/kernel.py @ 9:101e99452042

Dockerized project :)
author Brendan Rius <brendan@omixy.com>
date Sat, 26 Mar 2016 14:54:39 +0000
parents aa54c85303b6
children
line wrap: on
line diff
--- a/c_kernel/kernel.py	Fri Mar 25 15:03:55 2016 +0000
+++ b/c_kernel/kernel.py	Sat Mar 26 14:54:39 2016 +0000
@@ -28,6 +28,7 @@
         """Create a new temp file to be deleted when the kernel shuts down"""
         # We don't want the file to be deleted when closed, but only when the kernel stops
         kwargs['delete'] = False
+        kwargs['mode'] = 'w'
         file = tempfile.NamedTemporaryFile(**kwargs)
         self.files.append(file.name)
         return file
@@ -37,7 +38,7 @@
         """Execute a command and returns the return code, stdout and stderr"""
         p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         stdout, stderr = p.communicate()
-        return p.returncode, stdout, stderr
+        return p.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')
 
     @staticmethod
     def compile_with_gcc(source_filename, binary_filename):