From 9f2ed0478c3db6da8767485fa13678162d36f3bf Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Thu, 26 Oct 2017 11:01:39 -0400 Subject: [PATCH] Add ld_preload capability to runtime.run() Signed-off-by: Jonathan Rajotte --- lttng_ivc/utils/runtime.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lttng_ivc/utils/runtime.py b/lttng_ivc/utils/runtime.py index ac19e10..a89c23b 100644 --- a/lttng_ivc/utils/runtime.py +++ b/lttng_ivc/utils/runtime.py @@ -120,7 +120,7 @@ class Runtime(object): _logger.debug("Spawned sub pid: {} args: {} stdout: {} stderr{}".format(p.pid, p.args, out_path, err_path)) return tmp_id - def run(self, command_line, cwd=None, check_return=True): + def run(self, command_line, cwd=None, check_return=True, ld_preload=""): """ Run the command and return a tuple of a (CompletedProcess, stdout_path, stderr_path). The subprocess is already executed and returned. The @@ -129,6 +129,10 @@ class Runtime(object): args = shlex.split(command_line) env = self.get_env() + if ld_preload: + env['LD_PRELOAD'] = ld_preload + + tmp_id = self._run_command_count self._run_command_count += 1 -- 2.34.1