Skip to content

Commit

Permalink
avoid setting DYLD_FALLBACK_LIBRARY_PATH when the path is in the defa…
Browse files Browse the repository at this point in the history
…ult search path
  • Loading branch information
kmaehashi committed Aug 24, 2016
1 parent a707856 commit b17e0ed
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions jubakit/base.py
Expand Up @@ -704,8 +704,11 @@ def _get_process(cls, cmdline, *args, **kwargs):
cmdpath = distutils.spawn.find_executable(cmdline[0])
libpath = os.sep.join(cmdpath.split(os.sep)[:-2] + ['lib'])
if os.path.isfile(os.sep.join([libpath, 'libjubatus_core.dylib'])):
envvars['DYLD_FALLBACK_LIBRARY_PATH'] = libpath
_logger.info('setting DYLD_FALLBACK_LIBRARY_PATH to %s', libpath)
# If the estimated libpath is already in the default DYLD_FALLBACK_LIBRARY_PATH,
# we don't have to add it. See ``man 1 dyld`` for the list of default search paths.
if libpath not in [os.path.expanduser('~/lib'), '/usr/local/lib', '/lib', '/usr/lib']:
envvars['DYLD_FALLBACK_LIBRARY_PATH'] = libpath
_logger.info('setting DYLD_FALLBACK_LIBRARY_PATH to %s', libpath)
return subprocess.Popen(cmdline, env=envvars, *args, **kwargs)

class BaseConfig(dict):
Expand Down

0 comments on commit b17e0ed

Please sign in to comment.