sassc.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:tumanov_castleoaks 作者: Roamdev 项目源码 文件源码
def execute_command(self, command, content=None, cwd=None):
        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 isinstance(stderr, bytes):
            try:
                stderr = stderr.decode()
            except UnicodeDecodeError:
                pass

        if stderr.strip():
            raise CompilerError(stderr, error_output=stderr)

        if self.verbose:
            print(stderr)

        if pipe.returncode != 0:
            msg = "Command '{0}' returned non-zero exit status {1}".format(command, pipe.returncode)
            raise CompilerError(msg, error_output=msg)

        return stdout
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号