Skip to content

Conversation

dcantah
Copy link
Member

@dcantah dcantah commented Oct 14, 2025

Via scm_rights. Useful for supporting spawning runc as an OCI runtime as that's how the pty is passed to the client.


#include "socket_helpers.h"

struct cmsghdr* CZ_CMSG_FIRSTHDR(struct msghdr *msg) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Only reason is you can't call c macros in swift. So they need to be wrapped in a function we actually can.

let data = try receivedFileHandle.readToEnd()
#expect(data != nil, "Should be able to read from received FD")

let receivedContent = String(data: data!, encoding: .utf8)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a heads up that a failed #expect does not end the test. If the above check that data != nil fails, we will still get to this line, which I'm assuming may panic since data is nil.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to #require!

Copy link
Contributor

@katiewasnothere katiewasnothere left a comment

Choose a reason for hiding this comment

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

One small comment on the tests, otherwise LGTM

Via scm_rights. Useful for supporting spawning runc as an OCI runtime
as that's how the pty is passed to the client.
@dcantah dcantah merged commit 8a34763 into apple:main Oct 14, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants