rbo/st2-perltidy — Issue #3: OSX is not using additional params when Shell=True
Author: ewildgoose
Created: 2012-02-22 11:52:35+00:00
State: open

Not sure why, but my python on OSX Snow Leopard is ignoring the additional exe params when Shell=True

My patch:

diff --git a/PerlTidyCommand.py b/PerlTidyCommand.py
index 9bf6f30..9b94a15 100755
--- a/PerlTidyCommand.py
+++ b/PerlTidyCommand.py
@@ -20,9 +20,18 @@ import os.path
class PerlTidyCommand(sublime_plugin.TextCommand):
_perltidy_rc = ['.perltidyrc', 'perltidyrc']
_perltidy_cmd = None
+ _perltidy_params = [
+ "-i=2", # 2 col indent
+ "-bbt=1", # add only some spaces in single-line curly braces
+ "-pt=1", # dont add spaces inside parenthesis
+ "-nbbc", # don't add blank lines before comments
+ "-l=120", # wrap at column 100
+ "-ole=unix" # unix line endings
+ ]
+

def run(self, edit):
- print "run"
+ # print "run"
if not os.path.isfile(self.get_perltidy_cmd()):
sublime.error_message("Perltidy Error: Command not found:" + self.get_perltidy_cmd());
return
@@ -37,7 +46,7 @@ class PerlTidyCommand(sublime_plugin.TextCommand):
self.tidy_region(edit,sublime.Region(0L, self.view.size()))

def get_perltidy_cmd(self):
- print self.view.settings().get('perltidy_cmd')
+ # print self.view.settings().get('perltidy_cmd')
if self._perltidy_cmd is None:
self._perltidy_cmd = self.view.settings().get('perltidy_cmd')
if self._perltidy_cmd is None:
@@ -57,10 +66,10 @@ class PerlTidyCommand(sublime_plugin.TextCommand):
# default command
cmd = [
self.get_perltidy_cmd(),
- "-sbdl","-bbt=1","-pt=2", "-nbbc", "-l=100","-ole=unix",
"-w",
"-se"
]
+ cmd += self._perltidy_params

# try to find a perltidy rc file
for folder in self.view.window().folders():
@@ -72,7 +81,7 @@ class PerlTidyCommand(sublime_plugin.TextCommand):

p = subprocess.Popen(
cmd,
- shell = True,
+ shell = False, # On OSX True is ignoring additional params in cmd?
bufsize = -1,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,