Skip to content
Commit 1ab38f4f authored by Jon Dufresne's avatar Jon Dufresne Committed by Timothy Edmund Crosley
Browse files

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.
parent fad7265b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment