Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarolm committed Nov 23, 2019
1 parent cac9f73 commit eb67f4f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Default.sublime-settings
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"goguru_version" : "0.1.20", // DO NOT MODIFY
// Please do not edit this file, instead us the user config.
"goguru_version" : "0.1.21", // DO NOT MODIFY
// Please do not edit this file, instead use the user config.

// use golangconfig, if false then shellenv will be used to get golang environment variables
"goguru_use_golangconfig": false,
Expand Down
12 changes: 7 additions & 5 deletions goGuru.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,8 @@ def guru(self, end_offset, begin_offset=None, mode="describe", callback=None):
guru_json = "-json"

# Build guru cmd.
# modified update 22/10/2019 - 1 (DD/MM/YYYY)
# modified update 22/10/2019 - 3 (DD/MM/YYYY)
contents = self.view.substr(sublime.Region(0, self.view.size()))
contents_size = str(self.view.size())
cmd = "%(toolpath)s -modified %(scope)s %(tags)s %(guru_json)s %(mode)s %(file_path)s:%(pos)s" % {
"toolpath": toolpath,
"file_path": file_path,
Expand All @@ -394,11 +393,14 @@ def guru(self, end_offset, begin_offset=None, mode="describe", callback=None):
}
debug("cmd", cmd)

sublime.set_timeout_async(lambda: self.runInThread(cmd, callback, cmd_env, contents, contents_size, file_path), 0)
sublime.set_timeout_async(lambda: self.runInThread(cmd, callback, cmd_env, contents, file_path), 0)

def runInThread(self, cmd, callback, env, contents, contents_size, file_path):
def runInThread(self, cmd, callback, env, contents, file_path):
contentsbytes = contents.encode('utf-8',errors = 'strict')
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, shell=True, env=env)
proc.stdin.write(bytes(file_path+'\n'+contents_size+'\n'+contents, encoding='utf8'))
proc.stdin.write(bytes(file_path+'\n', encoding='utf8'))
proc.stdin.write(bytes(str(len(contentsbytes))+'\n', encoding='utf8'))
proc.stdin.write(contentsbytes)
out, err = proc.communicate()
callback(out.decode('utf-8'), err.decode('utf-8'))

Expand Down

0 comments on commit eb67f4f

Please sign in to comment.