call site 0 for compat.subprocess.Popen.wait
path/local/testing/test_local.py - line 238
236
237
238
239
240
   def test_sysexec(self):
       x = py.path.local.sysfind('ls') 
->     out = x.sysexec('-a')
       for x in py.path.local().listdir(): 
           assert out.find(x.basename) != -1
path/local/local.py - line 499
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
   def sysexec(self, *argv):
       """ return stdout-put from executing a system child process,
               where the self path points to the binary (XXX or script)
               to be executed. Note that this process is directly
               invoked and not through a system shell.
           """
       from py.compat.subprocess import Popen, PIPE
       argv = map(str, argv)
       proc = Popen([str(self)] + list(argv), stdout=PIPE, stderr=PIPE)
->     stdout, stderr = proc.communicate()
       ret = proc.wait()
       if ret != 0:
           raise py.process.cmdexec.Error(ret, ret, str(self),
                                          stdout, stderr,)
       return stdout
compat/subprocess.py - line 1083
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
   def communicate(self, input=None):
       """Interact with process: Send data to stdin.  Read data from
               stdout and stderr, until end-of-file is reached.  Wait for
               process to terminate.  The optional input argument should be a
               string to be sent to the child process, or None, if no data
               should be sent to the child.
   
               communicate() returns a tuple (stdout, stderr)."""
       read_set = []
       write_set = []
       stdout = None # Return
       stderr = None # Return
   
       if self.stdin:
           # Flush stdio buffer.  This might block, if the user has
           # been writing to .stdin in an uncontrolled fashion.
           self.stdin.flush()
           if input:
               write_set.append(self.stdin)
           else:
               self.stdin.close()
       if self.stdout:
           read_set.append(self.stdout)
           stdout = []
       if self.stderr:
           read_set.append(self.stderr)
           stderr = []
   
       while read_set or write_set:
           rlist, wlist, xlist = select.select(read_set, write_set, [])
   
           if self.stdin in wlist:
               # When select has indicated that the file is writable,
               # we can write up to PIPE_BUF bytes without risk
               # blocking.  POSIX defines PIPE_BUF >= 512
               bytes_written = os.write(self.stdin.fileno(), input[:512])
               input = input[bytes_written:]
               if not input:
                   self.stdin.close()
                   write_set.remove(self.stdin)
   
           if self.stdout in rlist:
               data = os.read(self.stdout.fileno(), 1024)
               if data == "":
                   self.stdout.close()
                   read_set.remove(self.stdout)
               stdout.append(data)
   
           if self.stderr in rlist:
               data = os.read(self.stderr.fileno(), 1024)
               if data == "":
                   self.stderr.close()
                   read_set.remove(self.stderr)
               stderr.append(data)
   
       # All data exchanged.  Translate lists into strings.
       if stdout != None:
           stdout = ''.join(stdout)
       if stderr != None:
           stderr = ''.join(stderr)
   
       # Translate newlines, if requested.  We cannot let the file
       # object do the translation: It is based on stdio, which is
       # impossible to combine with select (unless forcing no
       # buffering).
       if self.universal_newlines and hasattr(open, 'newlines'):
           if stdout:
               stdout = self._translate_newlines(stdout)
           if stderr:
               stderr = self._translate_newlines(stderr)
   
->     self.wait()
       return (stdout, stderr)