From 3ef9976d3873353f07a0f6fbf4fa4f03a93e8cc6 Mon Sep 17 00:00:00 2001 From: Dmitry Kovba Date: Tue, 28 Apr 2026 08:18:13 -0700 Subject: [PATCH] Fix compilation warnings (#696) Fix compilation warnings: ``` .../Sources/Containerization/LinuxContainer.swift:877:35: warning: 'weak' ownership of capture 'self' differs from implicitly-captured strong reference in outer scope [#ImplicitStrongCapture] 851 | /// via the `start` method. 852 | public func exec(_ id: String, configuration: @Sendable @escaping (inout LinuxProcessConfiguration) throws -> Void) async throws -> LinuxProcess { 853 | try await self.state.withLock { state in | |- note: 'self' implicitly strongly captured here | `- note: add 'self' as a capture list item to silence 854 | var startedState = try state.startedState("exec") 855 | : 875 | vm: startedState.vm, 876 | logger: self.logger, 877 | onDelete: { [weak self] in | |- warning: 'weak' ownership of capture 'self' differs from implicitly-captured strong reference in outer scope [#ImplicitStrongCapture] | `- note: explicitly assign the capture list item to silence 878 | await self?.removeProcess(id: id) 879 | } .../Sources/Containerization/LinuxContainer.swift:914:35: warning: 'weak' ownership of capture 'self' differs from implicitly-captured strong reference in outer scope [#ImplicitStrongCapture] 890 | /// via the `start` method. 891 | public func exec(_ id: String, configuration: LinuxProcessConfiguration) async throws -> LinuxProcess { 892 | try await self.state.withLock { | |- note: 'self' implicitly strongly captured here | `- note: add 'self' as a capture list item to silence 893 | var state = try $0.startedState("exec") 894 | : 912 | vm: state.vm, 913 | logger: self.logger, 914 | onDelete: { [weak self] in | |- warning: 'weak' ownership of capture 'self' differs from implicitly-captured strong reference in outer scope [#ImplicitStrongCapture] | `- note: explicitly assign the capture list item to silence 915 | await self?.removeProcess(id: id) 916 | } [#ImplicitStrongCapture]: ``` --- Sources/Containerization/LinuxContainer.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Containerization/LinuxContainer.swift b/Sources/Containerization/LinuxContainer.swift index 8a6e4782..699fbc6f 100644 --- a/Sources/Containerization/LinuxContainer.swift +++ b/Sources/Containerization/LinuxContainer.swift @@ -897,7 +897,7 @@ extension LinuxContainer { agent: agent, vm: startedState.vm, logger: self.logger, - onDelete: { [weak self] in + onDelete: { [weak self = self] in await self?.removeProcess(id: id) } ) @@ -934,7 +934,7 @@ extension LinuxContainer { agent: agent, vm: state.vm, logger: self.logger, - onDelete: { [weak self] in + onDelete: { [weak self = self] in await self?.removeProcess(id: id) } )