Fix ResourceWarning in openFolder() on Windows

subprocess.Popen emits ResourceWarning in the destructor if the status of the process was not read.
Fix by using subprocess.run() instead, which takes care of that.
Using run() is also recommended for simple cases like this in the docs.
This commit is contained in:
abdo 2021-03-29 07:37:03 +03:00
parent 0d49b3eabb
commit 47e80da1f8

View File

@ -688,7 +688,7 @@ def mungeQA(col: Collection, txt: str) -> str:
def openFolder(path: str) -> None:
if isWin:
subprocess.Popen(["explorer", f"file://{path}"])
subprocess.run(["explorer", f"file://{path}"], check=False)
else:
with noBundledLibs():
QDesktopServices.openUrl(QUrl(f"file://{path}"))