Commit f442fdbd authored by Bryton Lacquement's avatar Bryton Lacquement 🚪

wip

parent 20d6fe4b
......@@ -116,7 +116,7 @@ class SlapPopen(subprocess.Popen):
# don't leak log & co. filedescriptors to child process
kwargs.setdefault('close_fds', True)
subprocess.Popen.__init__(self, *args, **kwargs)
subprocess.Popen.__init__(self, universal_newlines=True, *args, **kwargs)
if debug:
self.wait()
self.output = '(output not captured in debug mode)'
......@@ -133,7 +133,7 @@ class SlapPopen(subprocess.Popen):
break
if line:
output_lines.append(line)
logger.info(line.rstrip(b'\n'))
logger.info(line.rstrip('\n'))
self.output = ''.join(output_lines)
......
......@@ -65,7 +65,7 @@ class SlapPopenTestCase(unittest.TestCase):
def test_debug(self):
"""Test debug=True, which keeps interactive.
"""
self.script.write('#!/bin/sh\necho "exit code?"\nread rc\nexit $rc')
self.script.write(b'#!/bin/sh\necho "exit code?"\nread rc\nexit $rc')
self.script.close()
# keep a reference to stdin and stdout to restore them later
......@@ -74,7 +74,7 @@ class SlapPopenTestCase(unittest.TestCase):
# replace stdin with a pipe that will write 123
child_stdin_r, child_stdin_w = os.pipe()
os.write(child_stdin_w, "123")
os.write(child_stdin_w, b"123")
os.close(child_stdin_w)
os.dup2(child_stdin_r, sys.stdin.fileno())
......@@ -88,7 +88,7 @@ class SlapPopenTestCase(unittest.TestCase):
debug=True,
logger=logging.getLogger())
# program output
self.assertEqual('exit code?\n', os.read(child_stdout_r, 1024))
self.assertEqual(b'exit code?\n', os.read(child_stdout_r, 1024))
self.assertEqual(123, program.returncode)
self.assertEqual('(output not captured in debug mode)', program.output)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment