From 78f45903de3df698f9ec94cdce2f34bd0088f145 Mon Sep 17 00:00:00 2001 From: Fletcher Dunn Date: Tue, 1 Sep 2020 17:27:03 -0700 Subject: [PATCH] Set LD_LIBRARY_PATH This is probably not the best way to do this, but it'll work for now --- tests/test_p2p.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/test_p2p.py b/tests/test_p2p.py index 97113e4..3036d89 100755 --- a/tests/test_p2p.py +++ b/tests/test_p2p.py @@ -8,6 +8,7 @@ import subprocess import threading +import os def RunProcess( tag, cmdline, **popen_kwargs ): @@ -17,8 +18,18 @@ def RunProcess( tag, cmdline, **popen_kwargs ): print( "%s> %s" % (tag, ln ) ) log.write( "%s\n" % ln ) + # Make a copy of the environment + env = dict( os.environ ) + + # Set LD_LIBRARY_PATH + if os.name == 'posix': + LD_LIBRARY_PATH = env.get( 'LD_LIBRARY_PATH', '' ) + if LD_LIBRARY_PATH: LD_LIBRARY_PATH += ';' + env['LD_LIBRARY_PATH'] = LD_LIBRARY_PATH + "." + WriteLn( "LD_LIBRARY_PATH = '%s'" % env['LD_LIBRARY_PATH']) + WriteLn( "Executing: " + ' '.join( cmdline ) ) - process = subprocess.Popen( cmdline, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT, **popen_kwargs ) + process = subprocess.Popen( cmdline, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT, env=env, **popen_kwargs ) process.stdin.close() while True: sOutput = process.stdout.readline()