From 335817990947addc255d8181c1a37523a1da68e5 Mon Sep 17 00:00:00 2001 From: Jayflux Date: Thu, 16 Mar 2017 12:31:02 +0000 Subject: [PATCH 1/2] adding back in cwd, not sure why it was missing (causing OSX to fail) --- SyntaxCheckPlugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SyntaxCheckPlugin.py b/SyntaxCheckPlugin.py index 458225b7..6b300732 100755 --- a/SyntaxCheckPlugin.py +++ b/SyntaxCheckPlugin.py @@ -89,6 +89,7 @@ def run_cargo(self, args, cwd): """Args should be an array of arguments for cargo. Returns list of dictionaries of the parsed JSON output. """ + # When sublime is launched from the dock in OSX, it does not have the user's environment set. So the $PATH env is reset. # This means ~./cargo/bin won't be added (causing rustup to fail), we can manually add it back in here. [This is a hack, hopefully Sublime fixes this natively] # fixes https://github.com/rust-lang/sublime-rust/issues/126 @@ -133,7 +134,7 @@ def get_rustc_messages(self, settings, file_name): if settings.get('rust_syntax_checking_include_tests', True): if not ('--test' in target_args or '--bench' in target_args): args.append('--test') - yield (target_src, self.run_cargo(args)) + yield (target_src, self.run_cargo(args, cwd)) def determine_targets(self, settings, file_name): """Detect the target/filters needed to pass to Cargo to compile From bfb9570c409867a249b92b09e68a4c1ebe4bfb85 Mon Sep 17 00:00:00 2001 From: Jayflux Date: Thu, 16 Mar 2017 12:34:18 +0000 Subject: [PATCH 2/2] cwd was removed by my previous commit, adding back in --- SyntaxCheckPlugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SyntaxCheckPlugin.py b/SyntaxCheckPlugin.py index 6b300732..32a98ded 100755 --- a/SyntaxCheckPlugin.py +++ b/SyntaxCheckPlugin.py @@ -101,7 +101,7 @@ def run_cargo(self, args, cwd): print('Running %r' % cmd) # shell=True is needed to stop the window popping up, although it looks like this is needed: # http://stackoverflow.com/questions/3390762/how-do-i-eliminate-windows-consoles-from-spawned-processes-in-python-2-7 - cproc = subprocess.Popen(cmd, + cproc = subprocess.Popen(cmd, cwd=cwd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, env=env) output = cproc.communicate()