<s> import os <EOL> import platform <EOL> from subprocess import Popen , PIPE <EOL> import sublime <EOL> IS_OSX = platform . system ( ) == '<STR_LIT>' <EOL> IS_WINDOWS = platform . system ( ) == '<STR_LIT>' <EOL> SETTINGS_FILE = '<STR_LIT>' <EOL> def node_bridge ( data , bin , cdir , args = [ ] ) : <EOL> settings = sublime . load_settings ( SETTINGS_FILE ) <EOL> env = None <EOL> if IS_OSX : <EOL> env = os . environ . copy ( ) <EOL> env [ '<STR_LIT>' ] += '<STR_LIT>' <EOL> try : <EOL> p = Popen ( [ settings . get ( '<STR_LIT>' , '<STR_LIT>' ) , bin ] + args , <EOL> stdout = PIPE , stdin = PIPE , stderr = PIPE , <EOL> cwd = cdir , env = env , shell = IS_WINDOWS ) <EOL> except OSError : <EOL> raise Exception ( '''<STR_LIT>''' ) <EOL> stdout , stderr = p . communicate ( input = data . encode ( '<STR_LIT:utf-8>' ) ) <EOL> stdout = stdout . decode ( '<STR_LIT:utf-8>' ) <EOL> stderr = stderr . decode ( '<STR_LIT:utf-8>' ) <EOL> if stderr : <EOL> raise Exception ( '<STR_LIT>' % stderr ) <EOL> else : <EOL> return stdout </s>
