TestCmd.py 文件源码

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

项目:gyp 作者: electron 项目源码 文件源码
def start(self, program = None,
                    interpreter = None,
                    arguments = None,
                    universal_newlines = None,
                    **kw):
        """
        Starts a program or script for the test environment.

        The specified program will have the original directory
        prepended unless it is enclosed in a [list].
        """
        cmd = self.command_args(program, interpreter, arguments)
        cmd_string = string.join(map(self.escape, cmd), ' ')
        if self.verbose:
            sys.stderr.write(cmd_string + "\n")
        if universal_newlines is None:
            universal_newlines = self.universal_newlines

        # On Windows, if we make stdin a pipe when we plan to send 
        # no input, and the test program exits before
        # Popen calls msvcrt.open_osfhandle, that call will fail.
        # So don't use a pipe for stdin if we don't need one.
        stdin = kw.get('stdin', None)
        if stdin is not None:
            stdin = subprocess.PIPE

        combine = kw.get('combine', self.combine)
        if combine:
            stderr_value = subprocess.STDOUT
        else:
            stderr_value = subprocess.PIPE

        return Popen(cmd,
                     stdin=stdin,
                     stdout=subprocess.PIPE,
                     stderr=stderr_value,
                     universal_newlines=universal_newlines)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号