miracle2k / python-closure

Closure compiler packaged for Python

Home Page:http://pypi.python.org/pypi/closure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use subprocess instead of os.execlp

zoomorph opened this issue · comments

os.execlp has poor support on Windows.

  1. It creates a new process. (Can't get the return code. And this messes with things like cygwin/msysgit.)
  2. It doesn't pass arguments correctly.

In my use case, os.execlp won't work on both Windows and Linux because the arguments are escaped wrongly on one or the other.

Switching to subprocess allows it to work fine on both.

Here is what I'm using:

import sys
import subprocess
from pkg_resources import resource_filename


def get_jar_filename():
    """Return the full path to the Closure Compiler Java archive."""
    return resource_filename(__name__, "closure.jar")


def main():
    return subprocess.call(['java', '-jar', get_jar_filename()] + sys.argv[1:])

@zoomorph can you please try the latest version and marked this issue closed if it solves your issue.

Thanks,