Esempio n. 1
0
    def _run_exec_popen(self, args, stderr_file=subprocess.PIPE):
        """popen to the wrapper script

        arguments:
          args: list of arguments to pass to popen().
          stderr_filename: if specified (as a string), write stderr to this filename.

        Returns a 3-tuple: stderr, stdout, returncode.
        """

        # We pass the empty environment dict here.
        # This is the *outer* environment that the current user will invoke the
        # command with. Command line arguments will have been appended *inside*
        # to adjust the new user's environment once the user switch has
        # occurred.
        child_pipe = subprocess.Popen(args, stdout=subprocess.PIPE,
                                      stderr=stderr_file, env={})
        return read_popen_output_carefully(child_pipe, platform=self.platform)
Esempio n. 2
0
    def _run_exec_popen(self, args, stderr_file=subprocess.PIPE):
        """popen to the wrapper script

        arguments:
          args: list of arguments to pass to popen().
          stderr_filename: if specified (as a string), write stderr to this filename.

        Returns a 3-tuple: stderr, stdout, returncode.
        """

        # We pass the empty environment dict here.
        # This is the *outer* environment that the current user will invoke the
        # command with. Command line arguments will have been appended *inside*
        # to adjust the new user's environment once the user switch has
        # occurred.
        child_pipe = subprocess.Popen(args, stdout=subprocess.PIPE,
                                      stderr=stderr_file, env={})
        return read_popen_output_carefully(child_pipe, platform=self.platform)
Esempio n. 3
0
def test_read_popen_output_carefully_0001():
    platform = detect_platform(None, None)
    process = subprocess32.Popen(["/bin/sleep", "5"], stdout=subprocess32.PIPE)
    _, _, _, timed_out = read_popen_output_carefully(process, platform, timeout=1)
    assert timed_out