Skip to content
This repository was archived by the owner on Jun 20, 2024. It is now read-only.

Commit 2030906

Browse files
authored
Merge pull request #58 from SethMichaelLarson/patch-4
Fix IGuestSession.execute() on Python 3 where stdout and stderr are of type MemoryView
2 parents 1d62528 + 236e5b4 commit 2030906

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

virtualbox/library_ext/guest_session.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ def execute(self, command, arguments=[], stdin="", environment=[],
4545
def read_out(process, flags, stdout, stderr):
4646
if library.ProcessCreateFlag.wait_for_std_err in flags:
4747
process.wait_for(int(library.ProcessWaitResult.std_err))
48-
e = str(process.read(2, 65000, 0))
48+
e = bytes(process.read(2, 65000, 0))
4949
stderr.append(e)
5050
if library.ProcessCreateFlag.wait_for_std_out in flags:
5151
process.wait_for(int(library.ProcessWaitResult.std_out))
52-
o = str(process.read(1, 65000, 0))
52+
o = bytes(process.read(1, 65000, 0))
5353
stdout.append(o)
5454

5555
process = self.process_create_ex(command,
@@ -85,7 +85,7 @@ def read_out(process, flags, stdout, stderr):
8585
# make sure we have read the remainder of the out
8686
read_out(process, flags, stdout, stderr)
8787

88-
return process, "".join(stdout), "".join(stderr)
88+
return process, b"".join(stdout), b"".join(stderr)
8989

9090
def makedirs(self, path, mode=0x777):
9191
"Super-mkdir: create a leaf directory and all intermediate ones."

0 commit comments

Comments
 (0)