Skip to content
This repository was archived by the owner on Mar 12, 2020. It is now read-only.

Commit 5b16505

Browse files
committed
Checking for cli path before running
1 parent f34d6a2 commit 5b16505

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

SQLToolsModels.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import sublime, os, threading, signal, shlex, subprocess, sys
1+
import sublime, os, threading, signal, shlex, subprocess, sys, shutil
22

33
sys.path.append(os.path.dirname(__file__))
44
if sys.version_info >= (3, 0):
@@ -96,7 +96,14 @@ def getSavedQuery(alias):
9696
class Connection:
9797

9898
def __init__(self, name, options):
99+
99100
self.cli = sublime.load_settings(Const.SETTINGS_FILENAME).get('cli')[options['type']]
101+
cli_path = shutil.which(self.cli)
102+
103+
if cli_path == None:
104+
sublime.message_dialog("'{0}' could not be found by Sublime Text.\n\nPlease set the '{0}' path in your SQLTools settings before continue.".format(self.cli))
105+
return
106+
100107
self.rowsLimit = sublime.load_settings(Const.SETTINGS_FILENAME).get('show_records').get('limit', 50)
101108
self.options = options
102109
self.name = name

0 commit comments

Comments
 (0)