Skip to content

Commit f779e2a

Browse files
committed
Swallow resources copy errors to work around permissions bug
swift-server#449 (comment)
1 parent db9f17c commit f779e2a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Plugins/AWSLambdaPackager/Plugin.swift

+10-4
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,16 @@ struct AWSLambdaPackager: CommandPlugin {
245245
let resourcesDirectoryName = artifactURL.lastPathComponent
246246
let relocatedResourcesDirectory = workingDirectory.appending(resourcesDirectoryName)
247247
if FileManager.default.fileExists(atPath: artifactURL.path()) {
248-
try FileManager.default.copyItem(
249-
atPath: artifactURL.path(),
250-
toPath: relocatedResourcesDirectory.string
251-
)
248+
do {
249+
try FileManager.default.copyItem(
250+
atPath: artifactURL.path(),
251+
toPath: relocatedResourcesDirectory.string
252+
)
253+
} catch {
254+
// Dangerous workaround for https://github.com/swift-server/swift-aws-lambda-runtime/issues/449#issuecomment-2595978246
255+
print("WARNING: Failed to copy resources item \(resourcesDirectoryName). The files may have been copied anyway, check your build. Error: \(error)")
256+
}
257+
252258
arguments.append(resourcesDirectoryName)
253259
}
254260
}

0 commit comments

Comments
 (0)