0

I need to write a code that can auto run cmd/git bash based on user input. Then I need to read the result from cmd/git bash to complete the script. Any idea how? -tia

  • learn about `subprocess.Popen()`. one note many people miss is that when reading its stdout pipe, you get `bytes` (in Python3), not `str` (string). – Skaperen Aug 07 '19 at 05:17

1 Answers1

1

Use subprocess.

#From subprocess Docs: 

subprocess.run(["ls", "-l"])  # doesn't capture output
CompletedProcess(args=['ls', '-l'], returncode=0)
thuva4
  • 1,007
  • 7
  • 11