Browse Source

refactor: replace `subprocess.check_output` with `subprocess.run`

> The new API is more consistent and is the recommended approach to invoking subprocesses in Python code [...]
https://docs.python.org/3/whatsnew/3.5.html#whatsnew-subprocess
Fabian Peter Hammerle 3 years ago
parent
commit
eae9a3b627
1 changed files with 3 additions and 1 deletions
  1. 3 1
      symuid/_uuid.py

+ 3 - 1
symuid/_uuid.py

@@ -65,4 +65,6 @@ def uuid_bytes_to_str(uuid_bytes: bytes) -> str:
 
 
 def generate_uuid4_bytes() -> bytes:
-    return subprocess.check_output(["uuid", "-v", "4", "-F", "BIN"]).strip()
+    return subprocess.run(
+        ["uuid", "-v", "4", "-F", "BIN"], stdout=subprocess.PIPE, check=True
+    ).stdout.strip()