diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -934,18 +934,18 @@ class Popen(object): errread = msvcrt.open_osfhandle(errread.Detach(), 0) if p2cwrite != -1: - self.stdin = io.open(p2cwrite, 'wb', bufsize) + self.stdin = io.open(p2cwrite, 'wb', bufsize, errors="surrogateescape") if universal_newlines: self.stdin = io.TextIOWrapper(self.stdin, write_through=True, line_buffering=(bufsize == 1)) if c2pread != -1: self.stdout = io.open(c2pread, 'rb', bufsize) if universal_newlines: - self.stdout = io.TextIOWrapper(self.stdout) + self.stdout = io.TextIOWrapper(self.stdout, errors="surrogateescape") if errread != -1: self.stderr = io.open(errread, 'rb', bufsize) if universal_newlines: - self.stderr = io.TextIOWrapper(self.stderr) + self.stderr = io.TextIOWrapper(self.stderr, errors="surrogateescape") self._closed_child_pipe_fds = False try: