|
2 | 2 |
|
3 | 3 | import sublime, sublime_plugin
|
4 | 4 | import os, sys, platform, subprocess, webbrowser, json, re, time, atexit
|
| 5 | +from subprocess import CalledProcessError |
5 | 6 | try:
|
6 | 7 | # python 2
|
7 | 8 | from utils.renderer import create_renderer
|
@@ -608,13 +609,15 @@ def plugin_loaded():
|
608 | 609 | "Yes, install."):
|
609 | 610 | try:
|
610 | 611 | if hasattr(subprocess, "check_output"):
|
611 |
| - subprocess.check_output(["npm", "install"], cwd=plugin_dir) |
| 612 | + subprocess.check_output(["npm", "--loglevel=silent", "install"], cwd=plugin_dir, shell=windows) |
612 | 613 | else:
|
613 |
| - subprocess.check_call(["npm", "install"], cwd=plugin_dir) |
614 |
| - except (IOError, OSError) as e: |
| 614 | + subprocess.check_call(["npm", "--loglevel=silent", "install"], cwd=plugin_dir, shell=windows) |
| 615 | + except (IOError, OSError, CalledProcessError) as e: |
615 | 616 | msg = "Installation failed. Try doing 'npm install' manually in " + plugin_dir + "."
|
616 |
| - if hasattr(e, "output"): |
617 |
| - msg += " Error message was:\n\n" + e.output |
| 617 | + if hasattr(e, "output") and e.output is not None: |
| 618 | + msg += "\nError message was:\n\n" + e.output |
| 619 | + if hasattr(e, "returncode"): |
| 620 | + msg += "\nReturn code was: " + str(e.returncode) |
618 | 621 | sublime.error_message(msg)
|
619 | 622 | return
|
620 | 623 | tern_command = ["node", os.path.join(plugin_dir, "node_modules/tern/bin/tern"), "--no-port-file"]
|
|
0 commit comments