@@ -592,19 +592,36 @@ def execute(self, command,
592592 log .debug ("Popen(%s, cwd=%s, universal_newlines=%s, shell=%s)" ,
593593 command , cwd , universal_newlines , shell )
594594 try :
595- proc = Popen (command ,
596- env = env ,
597- cwd = cwd ,
598- bufsize = - 1 ,
599- stdin = istream ,
600- stderr = PIPE ,
601- stdout = stdout_sink ,
602- shell = shell is not None and shell or self .USE_SHELL ,
603- close_fds = is_posix , # unsupported on windows
604- universal_newlines = universal_newlines ,
605- creationflags = PROC_CREATIONFLAGS ,
606- ** subprocess_kwargs
607- )
595+ if type (isteam ) in {str , bytes }:
596+ proc = Popen (command ,
597+ env = env ,
598+ cwd = cwd ,
599+ bufsize = - 1 ,
600+ stdin = PIPE ,
601+ stderr = PIPE ,
602+ stdout = stdout_sink ,
603+ shell = shell is not None and shell or self .USE_SHELL ,
604+ close_fds = is_posix , # unsupported on windows
605+ universal_newlines = universal_newlines ,
606+ creationflags = PROC_CREATIONFLAGS ,
607+ ** subprocess_kwargs
608+ )
609+ proc .stdin .write (istream )
610+
611+ else :
612+ proc = Popen (command ,
613+ env = env ,
614+ cwd = cwd ,
615+ bufsize = - 1 ,
616+ stdin = istream ,
617+ stderr = PIPE ,
618+ stdout = stdout_sink ,
619+ shell = shell is not None and shell or self .USE_SHELL ,
620+ close_fds = is_posix , # unsupported on windows
621+ universal_newlines = universal_newlines ,
622+ creationflags = PROC_CREATIONFLAGS ,
623+ ** subprocess_kwargs
624+ )
608625 except cmd_not_found_exception as err :
609626 raise GitCommandNotFound (command , err )
610627
0 commit comments