Use full path and arguments for subprocess

This commit is contained in:
Mykola Grymalyuk
2023-12-30 13:49:59 -07:00
parent b46e55d3f6
commit 0dfcf03c0c
23 changed files with 152 additions and 154 deletions

View File

@@ -108,10 +108,10 @@ class InstallerCreation():
logging.info(f"Creating temporary directory at {ia_tmp}")
# Delete all files in tmp_dir
for file in Path(ia_tmp).glob("*"):
subprocess.run(["rm", "-rf", str(file)])
subprocess.run(["/bin/rm", "-rf", str(file)])
# Copy installer to tmp (use CoW to avoid extra disk writes)
args = ["cp", "-cR", installer_path, ia_tmp]
args = ["/bin/cp", "-cR", installer_path, ia_tmp]
if utilities.check_filesystem_type() != "apfs":
# HFS+ disks do not support CoW
args[1] = "-R"
@@ -623,7 +623,7 @@ class LocalInstallerCatalog:
output = subprocess.run(
[
"hdiutil", "attach", "-noverify", sharedsupport_path,
"/usr/bin/hdiutil", "attach", "-noverify", sharedsupport_path,
"-mountpoint", tmpdir,
"-nobrowse",
],
@@ -644,6 +644,6 @@ class LocalInstallerCatalog:
detected_os = plist["Assets"][0]["OSVersion"]
# Unmount SharedSupport.dmg
subprocess.run(["hdiutil", "detach", tmpdir], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
subprocess.run(["/usr/bin/hdiutil", "detach", tmpdir], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
return (detected_build, detected_os)