# HG changeset patch # User Ludovic Chabant # Date 1408405988 25200 # Node ID de6a296744f77c589f476b5a37fbc52987268642 # Parent 3a13b43e77c19de66145e3986c6d91b972e2583b The LESS compiler must be launched in a shell on Windows. diff -r 3a13b43e77c1 -r de6a296744f7 piecrust/processing/less.py --- a/piecrust/processing/less.py Mon Aug 18 16:51:38 2014 -0700 +++ b/piecrust/processing/less.py Mon Aug 18 16:53:08 2014 -0700 @@ -3,6 +3,7 @@ import json import hashlib import logging +import platform import subprocess from piecrust.processing.base import SimpleFileProcessor from piecrust.processing.tree import FORCE_BUILD @@ -52,7 +53,17 @@ args.append(in_path) args.append(out_path) logger.debug("Processing LESS file: %s" % args) - retcode = subprocess.call(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: + retcode = subprocess.call(args, shell=shell) + except FileNotFoundError as ex: + logger.error("Tried running LESS processor with command: %s" % + args) + raise Exception("Error running LESS processor. " + "Did you install it?") from ex if retcode != 0: raise Exception("Error occured in LESS compiler. Please check " "log messages above for more information.")