Skip to content

Adapte swift 6 error #71

@williamhqs

Description

@williamhqs

When to use this library in swift 6 mode:


    try await withThrowingTaskGroup(of: Bool.self) { group in
            let session = try SSH(host: "xxx", port: xxx)
            // xxx
            let sftp = try session.openSftp()
            for file in files {
                group.addTask { <--- This line comes the error
                    return try await self.upload(file: file, with: sftp, session: session)
                }
            }
}

The error on the addTask:

Value of non-Sendable type '@isolated(any) @async @callee_guaranteed @substituted <τ_0_0> () -> (@out τ_0_0, @error any Error) for <Bool>' accessed after being transferred; later accesses could race; this is an error in the Swift 6 language mode

Please considering to make the related file to sendable could be solve the issue. thanks!

Screenshot 2024-10-10 at 14 08 38

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions