Mercurial > piecrust2
diff piecrust/processing/less.py @ 17:de6a296744f7
The LESS compiler must be launched in a shell on Windows.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 18 Aug 2014 16:53:08 -0700 |
parents | 343d08ef5668 |
children | 1c13f3389fcb |
line wrap: on
line diff
--- 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.")