diff options
author | Sam Thursfield <ssssam@gmail.com> | 2016-06-13 13:26:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-13 13:26:16 +0100 |
commit | be1851a372cb54c129c08f97c6e5f7dda372bb47 (patch) | |
tree | 4fa646db59d495a483f44aea5808fafac640e970 | |
parent | e355e2473b5709f84683471895936e261994b7a7 (diff) | |
parent | 77066a0691c2fbdf60c80320cb3210ee1b191774 (diff) | |
download | sandboxlib-be1851a372cb54c129c08f97c6e5f7dda372bb47.tar.gz |
Merge pull request #20 from gtristan/ensure-loaded-module
Issue 19 and 17: Awful hack to ensure string-escape is loaded
-rw-r--r-- | sandboxlib/chroot.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sandboxlib/chroot.py b/sandboxlib/chroot.py index 41fd4de..c0d13f8 100644 --- a/sandboxlib/chroot.py +++ b/sandboxlib/chroot.py @@ -219,6 +219,15 @@ def run_sandbox(command, cwd=None, env=None, pipe_parent, pipe_child = multiprocessing.Pipe() with mount_all(filesystem_root, extra_mounts): + + # Awful hack to ensure string-escape is loaded: + # + # this ensures that when propagating an exception back from + # the child process in a chroot, the required string-escape + # python module is already in memory and no attempt to + # lazy load it in the chroot is made. + unused = "Some Text".encode('string-escape') + process = multiprocessing.Process( target=run_command_in_chroot, args=(pipe_child, stdout, stderr, extra_mounts, filesystem_root, |