def run_script_on_file(self, temp_file_path):
try:
node_path = PluginUtils.get_node_path()
script_path = PLUGIN_FOLDER + "/scripts/run.js"
file_path = self.view.file_name()
cmd = [node_path, script_path, temp_file_path, file_path or "?"]
output = SoliumGutterCommand.get_output(cmd)
print(output)
if output.find(OUTPUT_VALID) != -1:
output = output.decode('utf-8');
return output
print(output)
raise Exception(output)
except:
# Something bad happened.
print("Unexpected error({0}): {1}".format(sys.exc_info()[0], sys.exc_info()[1]))
# Usually, it's just node.js not being found. Try to alleviate the issue.
msg = "Node.js was not found in the default path. Please specify the location."
if not sublime.ok_cancel_dialog(msg):
msg = "You won't be able to use this plugin without specifying the path to node.js."
sublime.error_message(msg)
else:
PluginUtils.open_sublime_settings(self.view.window())
评论列表
文章目录