better logs, don't run codesign if no assets are found (#4464)
This commit is contained in:
1 parent
f9f30263d3
commit
66c2dac38f
5 files changed
+119
-54
No files matched your search
@@ -337,19 +337,21 @@ pub(crate) fn extract_assets_from_file(path: impl AsRef<Path>) -> Result<AssetMa
|
||||
// Write the modified binary data back to the file
|
||||
file.write_all(new_data.as_ref())?;
|
||||
}
|
||||
|
||||
// Ensure the file is flushed to disk
|
||||
file.sync_all()
|
||||
.context("Failed to sync file after writing assets")?;
|
||||
|
||||
// If the file is a macos binary, we need to re-sign the modified binary
|
||||
if object_file.format() == object::BinaryFormat::MachO {
|
||||
if object_file.format() == object::BinaryFormat::MachO && !assets.is_empty() {
|
||||
// Spawn the codesign command to re-sign the binary
|
||||
let output = std::process::Command::new("codesign")
|
||||
.arg("--force")
|
||||
.arg("--sign")
|
||||
.arg("-") // Sign with an empty identity
|
||||
.arg(path)
|
||||
.output()?;
|
||||
.output()
|
||||
.context("Failed to run codesign - is `codesign` in your path?")?;
|
||||
|
||||
if !output.status.success() {
|
||||
bail!(
|
||||
|
||||
Reference in new issue
Block a user