Skip to content

Commit

Permalink
Adds customizable node path #19
Browse files Browse the repository at this point in the history
  • Loading branch information
mihai-vlc committed Dec 5, 2014
1 parent 1a44c95 commit d451fb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions jsfmt.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
"type": "double"
}
},
"node-path": "node",
"alert-errors": true
}
6 changes: 5 additions & 1 deletion node_bridge.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import os
import platform
from subprocess import Popen, PIPE
import sublime

IS_OSX = platform.system() == 'Darwin'
IS_WINDOWS = platform.system() == 'Windows'
SETTINGS_FILE = 'jsfmt.sublime-settings'

def node_bridge(data, bin, cdir, args=[]):
settings = sublime.load_settings(SETTINGS_FILE)
print(settings.get('node-path'))
env = None
if IS_OSX:
# GUI apps in OS X doesn't contain .bashrc/.zshrc set paths
env = os.environ.copy()
env['PATH'] += ':/usr/local/bin'
try:
p = Popen(['node', bin] + args,
p = Popen([settings.get('node-path', 'node'), bin] + args,
stdout=PIPE, stdin=PIPE, stderr=PIPE,
cwd=cdir, env=env, shell=IS_WINDOWS)
except OSError:
Expand Down

0 comments on commit d451fb5

Please sign in to comment.