Simplify subprocess use with high level run API
Per the Python docs, subprocess.run() is the preferred interface for running subprocess and replaces the older API (such as subprocess.check_output()) https://docs.python.org/3/library/subprocess.html > The recommended approach to invoking subprocesses is to use the run() > function for all use cases it can handle. For more advanced use cases, > the underlying Popen interface can be used directly. > > > The run() function was added in Python 3.5; if you need to retain > compatibility with older versions, see the Older high-level API > section. Allows for: - Return a str from get_output() to decode once instead of every line of the result. - Pass command arguments as a list of strings to ensure no possibility for unescaped shell injection.
Loading
Please register or sign in to comment