Skip to content

Commit 1599895

Browse files
committed
Fix consecutive builds with --strip
1 parent 2ecea0c commit 1599895

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Sources/SwiftBundler/Commands/BundleCommand.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,13 +692,20 @@ struct BundleCommand: ErrorHandledCommand {
692692
}
693693

694694
if resolvedPlatform == .linux {
695+
let debugInfoFile = originalExecutableArtifact.appendingPathExtension("debug")
696+
if debugInfoFile.exists() {
697+
try FileManager.default.removeItem(at: debugInfoFile)
698+
}
695699
try await Stripper.extractLinuxDebugInfo(
696700
from: originalExecutableArtifact,
697-
to: originalExecutableArtifact.appendingPathExtension("debug")
701+
to: debugInfoFile
698702
).unwrap()
699703
}
700704

701705
if arguments.strip {
706+
if executableArtifact.exists() {
707+
try FileManager.default.removeItem(at: executableArtifact)
708+
}
702709
try FileManager.default.copyItem(at: originalExecutableArtifact, to: executableArtifact)
703710
try await Stripper.strip(executableArtifact).unwrap()
704711
}

0 commit comments

Comments
 (0)