summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2016-06-13 20:55:49 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2016-06-13 20:55:49 +0900
commit77066a0691c2fbdf60c80320cb3210ee1b191774 (patch)
tree4fa646db59d495a483f44aea5808fafac640e970
parente355e2473b5709f84683471895936e261994b7a7 (diff)
downloadsandboxlib-77066a0691c2fbdf60c80320cb3210ee1b191774.tar.gz
Issue 19 and 17: Awful hack to ensure string-escape is loaded
This hack 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.
-rw-r--r--sandboxlib/chroot.py9
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,