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 d279ca4cac
commit 472acd30e5

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}"))