Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not force unwrap stdout #398

Merged
merged 6 commits into from
Oct 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Plugins/AWSLambdaPackager/PluginUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct Utils {

let fd = dup(1)
let stdout = fdopen(fd, "rw")
defer { fclose(stdout!) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should change ci to use the released swift image here. I think the build issue happens with swift:6.0.0 and swift:6.0.1 but not 6.0-nightly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As much as I understand how it works in Swift-NIO, we can not give the container name as a parameter
https://github.com/apple/swift-nio/blob/main/.github/workflows/swift_6_language_mode.yml

That would be a change request for the Swift-NIO project

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with ! is not in the CI, it crashes the plugin when using it. We can not force unwrap, there are cases where stdout is nil

defer { if let so = stdout { fclose(so) } }

// We need to use an unsafe transfer here to get the fd into our Sendable closure.
// This transfer is fine, because we write to the variable from a single SerialDispatchQueue here.
Expand Down
Loading