Skip to content

Commit f22cdbe

Browse files
committed
Pass current working directory to popen
- benmatselbyGH-68 - Helps PHP_CodeSniffer 1.5.0+ work in ST2 - Add some debug to help in the future
1 parent 8bb2d4c commit f22cdbe

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Sublime PHP CodeSniffer, Linter and Mess Detector Plugin Changelog
22
==================================================================
33

4+
6.1
5+
---
6+
* Bug fix for users of ST2 and PHP_CodeSniffer1.5.0 (Currently RC1). Essentially we now need to pass cwd so that PHP_CodeSniffer knows where to put the tmp files for its caching mechanism. Fixes [GH-68](https://github.com/benmatselby/sublime-phpcs/issues/68)
7+
48
6.0.1
59
-----
610
* Missed a s/SCheck/scheck/ conversion

phpcs.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from HTMLParser import HTMLParser
1111
except:
1212
from html.parser import HTMLParser
13+
from os.path import expanduser
1314

1415
class Pref:
1516
@staticmethod
@@ -113,7 +114,15 @@ def shell_out(self, cmd):
113114
info.dwFlags |= subprocess.STARTF_USESHOWWINDOW
114115
info.wShowWindow = subprocess.SW_HIDE
115116

116-
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, startupinfo=info)
117+
"""
118+
Fixes the fact that PHP_CodeSniffer now caches the reports to cwd()
119+
- http://pear.php.net/package/PHP_CodeSniffer/download/1.5.0
120+
- https://github.com/benmatselby/sublime-phpcs/issues/68
121+
"""
122+
home = expanduser("~")
123+
debug_message("cwd: " + home)
124+
125+
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, startupinfo=info, cwd=home)
117126

118127
if proc.stdout:
119128
data = proc.communicate()[0]

0 commit comments

Comments
 (0)