Loading topic
subprocess.run, and the object it returns. Later chapters cover arguments, ou2 min readsubprocess.run and read a CompletedProcess. The first argument to run is the command. You can pass it as a list or as a string, and the two forms behave differently.2 min readsubprocess.run with an argument list and know that a process has separate standard output (stdout) and standard error (stderr) streams. It also assumes you know the difference between bytes and str.2 min readsubprocess.run, capture output as text, and handle Python exceptions. It covers how to tell whether a command succeeded and how to make failure raise an error.2 min readsubprocess.run, the check=True option and CalledProcessError, and Python's exception hierarchy.2 min readsubprocess.run, capture output, and handle exceptions. A child process can hang, for example when it waits on a network call or for input that never arrives. Without a limit, your program hangs with it. The timeout argument gives you that limit.2 min readsubprocess.run, capture output with capture_output=True, and read CompletedProcess results. You also need to know what standard input (stdin) is: the stream a program reads data from when it is not given a file.2 min readsubprocess.run, capture output, and handle CalledProcessError. Here you control two things a child process inherits from your program: its environment variables and its working directory.2 min readsubprocess.run, know what an exit code is, and understand the difference between a list of arguments and a command string. It covers how shell injection happens and the habits that prevent it.2 min readsubprocess.run, its capture_output, text and check arguments, and how exit codes work. subprocess.run covers most jobs. Popen is the class underneath it, and it is the right tool when you need control while the child is still running.2 min readsubprocess.run, capture_output, and the basics of Popen from the previous chapter. run waits for the child to finish and returns all its output at once. For a long job, such as a build or a log tail, you often want each line as soon as it appears. Popen gives 3 min readsubprocess.run, the basics of Popen (including communicate), and that every process has standard input, output and error streams. A pipeline connects the output of one process to the input of another, as the shell does with producer | consumer.2 min readPopen, know what standard output and standard error are, and have seen communicate() and line-by-line streaming.2 min readsubprocess.run, pass argument lists, and capture output as text. It covers where the same code behaves differently on Windows, macOS and Linux. macOS and Linux are both POSIX systems, so they behave alike. Windows is the outlier.2 min readsubprocess.run and Popen from earlier chapters, and that you have basic familiarity with async and await. If you have not used asyncio before, treat this chapter as a preview.2 min read