-
Notifications
You must be signed in to change notification settings - Fork 17
Adopt ~Copyable in Subprocess
#38
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
base: main
Are you sure you want to change the base?
Adopt ~Copyable in Subprocess
#38
Conversation
821723e
to
2754c5f
Compare
2754c5f
to
f126559
Compare
// Input | ||
var result: Int32 = -1 | ||
if let inputRead = inputPipe.readFileDescriptor { | ||
result = posix_spawn_file_actions_adddup2(&fileActions, inputRead.platformDescriptor, 0) | ||
if inputReadFileDescriptor != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest using if let inputReadFileDescriptor {
so you don't need the force unwrap below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this pattern, along with if let a = a
is not compatible with ~Copyable
types. Writing if let inputReadFileDescriptor
would have consumed inputReadFileDescriptor
so the line below would be double consume.
f126559
to
2d28695
Compare
2d28695
to
7c35edb
Compare
Addressed review comments and removed |
This PR introduces
~Copyable
intoSubprocess
, includingCreatedPipe
,TrackedFileDescriptor
, andTrackedDispatchIO
.Resolves #37
Resolves #2
Additionally, we opted to slightly modify the API by moving the
.standardOutput
and.standardError
AsyncSequence
fromExecution
to the closure parameter, alongsideExecution
. This adjustment eliminated the necessity forAtomic
(andAtomicBox
) withinExecution
.Furthermore, this change rendered
SequenceOutput
internal, as we now rely on overloads to infer the output and error types.This patch also drops support for
Swift 6.0
because it can't properly support the~Copyable
work. NowSwift 6.1
is the minimal required Swift version to buildSubprocess