Merge pull request #6416 from bryant1410/patch-1

Fix when `sys.executable` is empty or null
This commit is contained in:
Hugo van Kemenade 2022-07-06 09:12:27 +03:00 committed by GitHub
commit 14b457e15e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -178,14 +178,16 @@ class MacViewer(Viewer):
else:
raise TypeError("Missing required argument: 'path'")
subprocess.call(["open", "-a", "Preview.app", path])
subprocess.Popen(
[
sys.executable,
"-c",
"import os, sys, time; time.sleep(20); os.remove(sys.argv[1])",
path,
]
)
executable = sys.executable or shutil.which("python3")
if executable:
subprocess.Popen(
[
executable,
"-c",
"import os, sys, time; time.sleep(20); os.remove(sys.argv[1])",
path,
]
)
return 1