Merge pull request #114 from dzhibas/fix-st3/issue-43

Fix st3/issue 45
This commit is contained in:
Terminal 2020-04-17 22:46:32 -04:00 committed by GitHub
commit 8abbb888dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View File

@ -8,5 +8,6 @@
"keep_arrays_single_line": false,
"max_arrays_line_length": 120,
"pretty_on_save": false,
"validate_on_save": true
"validate_on_save": true,
"jq_binary": "jq"
}

View File

@ -27,7 +27,7 @@ SUBLIME_MAJOR_VERSION = int(sublime.version()) / 1000
jq_exits = False
jq_init = False
jq_path = str()
""" for OSX we need to manually add brew bin path so jq can be found """
if sys.platform != "win32" and "/usr/local/bin" not in os.environ["PATH"]:
@ -38,20 +38,20 @@ if sys.platform != "win32" and "/usr/local/bin" not in os.environ["PATH"]:
def check_jq():
global jq_exits
global jq_init
global jq_exits, jq_init, jq_path
if not jq_init:
jq_init = True
jq_path = s.get("jq_binary", "jq")
try:
# checking if ./jq tool is available so we can use it
s = subprocess.Popen(
["jq", "--version"],
jq = subprocess.Popen(
[jq_path, "--version"],
stdin=subprocess.PIPE,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
)
out, err = s.communicate()
out, err = jq.communicate()
jq_exits = True
except OSError:
os_exception = sys.exc_info()[1]
@ -334,7 +334,7 @@ class JqPrettyJson(sublime_plugin.WindowCommand):
def done(self, query):
try:
p = subprocess.Popen(
["jq", query],
[jq_path, query],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE,