diff piecrust/processing/less.py @ 1112:a3dec0fbd9ce

bake: Fix bug on Windows where shim scripts of NodeJS tools couldn't run.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 20 Feb 2018 22:15:57 -0800
parents 63be34ce6e65
children fac4483867a5
line wrap: on
line diff
--- a/piecrust/processing/less.py	Sun Feb 18 20:37:54 2018 -0800
+++ b/piecrust/processing/less.py	Tue Feb 20 22:15:57 2018 -0800
@@ -77,13 +77,8 @@
         args.append(out_path)
         logger.debug("Processing LESS file: %s" % args)
 
-        # On Windows, we need to run the process in a shell environment
-        # otherwise it looks like `PATH` isn't taken into account.
-        shell = (platform.system() == 'Windows')
         try:
-            proc = subprocess.Popen(
-                args, shell=shell,
-                stderr=subprocess.PIPE)
+            proc = subprocess.Popen(args, stderr=subprocess.PIPE)
             stdout_data, stderr_data = proc.communicate()
         except FileNotFoundError as ex:
             logger.error("Tried running LESS processor with command: %s" %
@@ -105,8 +100,12 @@
         if self._conf is not None:
             return
 
+        bin_name = 'lessc'
+        if platform.system() == 'Windows':
+            bin_name += '.cmd'
+
         self._conf = self.app.config.get('less') or {}
-        self._conf.setdefault('bin', 'lessc')
+        self._conf.setdefault('bin', bin_name)
         self._conf.setdefault('options', ['--compress'])
         if not isinstance(self._conf['options'], list):
             raise Exception("The `less/options` configuration setting "