MCPcopy
hub / github.com/jisaacks/GitGutter / popen

Method popen

modules/handler.py:842–883  ·  view source on GitHub ↗

Prepare the environment and spawn the subprocess. Arguments: args (list): A list of arguments to pass to `subprocess.Popen`. stdout (int or stream): The target of the output of the spawned subprocess. It defaults to `su

(self, args, stdout=subprocess.PIPE)

Source from the content-addressed store, hash-verified

840 return Promise(executor)
841
842 def popen(self, args, stdout=subprocess.PIPE):
843 """Prepare the environment and spawn the subprocess.
844
845 Arguments:
846 args (list):
847 A list of arguments to pass to `subprocess.Popen`.
848 stdout (int or stream):
849 The target of the output of the spawned subprocess.
850 It defaults to `subprocess.PIPE` to retrieve output via stdout,
851 but can also be a filestream to directly write the content to
852 a file on disk.
853 Returns:
854 subprocess.Popen: The object of the spawned subprocess.
855 """
856 startupinfo = None
857 if WIN32:
858 startupinfo = subprocess.STARTUPINFO()
859 startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
860
861 # run git through wsl.exe
862 if self._git_wsl:
863 args.insert(0, "wsl")
864
865 # update private environment
866 if self._git_env is None:
867 self._git_env = os.environ.copy()
868 for key, value in self.settings.get('env', {}).items():
869 if value is None:
870 del self._git_env[key]
871 else:
872 self._git_env[key] = str(value)
873
874 return subprocess.Popen(
875 args=args,
876 cwd=self._git_tree,
877 env=self._git_env,
878 bufsize=_BUFSIZE,
879 startupinfo=startupinfo,
880 stdin=subprocess.PIPE, # python 3.3 bug on Win7
881 stderr=subprocess.PIPE,
882 stdout=stdout
883 )

Callers 3

versionMethod · 0.95
git_read_fileMethod · 0.95
execute_asyncMethod · 0.95

Calls 1

getMethod · 0.80

Tested by

no test coverage detected