'This is like the one in SubProcessCompiler, except it checks the exit code.'

def execute_command(self, command, content=None, cwd=None):

    import subprocess
    pipe = subprocess.Popen(command, shell=True, cwd=cwd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
    if content:
        content = smart_bytes(content)
    (stdout, stderr) = pipe.communicate(content)
    if self.verbose:
        print stderr
    if (pipe.returncode != 0):
        raise CompilerError(stderr)
    return stdout
