Permalink
Browse files

Use `echo $PATH` instead of parsing `env`

Environment variables (e.g. `__CF_USER_TEXT_ENCODING`) with line feeds
in their value make `readfiles_exported_paths()` crash on Mac OS X; this
commit make it retrieve only the value of `$PATH` instead of the whole
environment.
  • Loading branch information...
1 parent 97dbd6c commit 2ef5d5aa01d94e43925387f0263edd90c8bd686d @nox nox committed with Jun 17, 2012
Showing with 3 additions and 4 deletions.
  1. +3 −4 sublimerl.py
View
@@ -213,10 +213,9 @@ def readfiles_exported_paths(self, file_paths):
concatenated_paths = []
for file_path in file_paths:
if os.path.exists(file_path):
- p = subprocess.Popen(". %s; env" % file_path, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
- data, stderr = p.communicate()
- env = dict((line.split("=", 1) for line in data.splitlines()))
- concatenated_paths.append(env['PATH'].strip())
+ p = subprocess.Popen(". %s; echo $PATH" % file_path, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ path, stderr = p.communicate()
+ concatenated_paths.append(path.strip())
return ''.join(concatenated_paths)
def get_erlang_module_name(self):

0 comments on commit 2ef5d5a

Please sign in to comment.