-
Notifications
You must be signed in to change notification settings - Fork 584
Relocate ProcessIO to ContainerClient. #681
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
Conversation
| ) | ||
| } | ||
|
|
||
| public static func handleProcess(io: ProcessIO, process: ClientProcess) async throws -> Int32 { |
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.
this becomes an instance function in ProcessIO.swift()
| ) | ||
| } | ||
|
|
||
| public func handleProcess(process: ClientProcess, log: Logger) async throws -> Int32 { |
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.
relocated from Application.swift:
- now an instance function so the
ioparameter just becomesself - was using the
logmember from Application before, the caller now passeslogin
| @@ -0,0 +1,381 @@ | |||
| //===----------------------------------------------------------------------===// | |||
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.
extracted from ContainerRun in the ContainerCommands target to this file in the ContainerClient target
| case table | ||
| } | ||
|
|
||
| static let signalSet: [Int32] = [ |
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.
These were only used by handleProcess so they've also moved to ProcessIO
| let stderr: Pipe? | ||
| var ioTracker: IoTracker? | ||
|
|
||
| static let signalSet: [Int32] = [ |
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.
moved to here from Application.swift
| } | ||
| } | ||
| } | ||
|
|
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.
All of this is now down in ProcessIO.swift in ContainerClient.
- Makes ProcessIO more generally available. - `Application.handleProcess(processIO:process:)` becomes `processIO.handleProcess(process:log:)`.
3c4e9b1 to
bd63ced
Compare
katiewasnothere
left a comment
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.
LGTM. The annotations were very helpful, thank you for adding those :)
| ) | ||
| } | ||
|
|
||
| public func handleProcess(process: ClientProcess, log: Logger) async throws -> Int32 { |
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.
I like the ProcessIO move, but I'm not as big of a fan about this method on here. To me anything that would call start() or handle process lifecycle makes more sense on the ClientProcess type itself. A run() method on ClientProcess might be a decent naming, as that's essentially what this is. We start + wait + consume IO until completion.
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.
Thinking more about this, not entirely related but, to even be able to get a ClientProcess object we need to pass the io type into bootstrap() or createProcess(), why don't we just have ClientProcess manage the IO type directly? e.g. it can call closeAfterStart() inside the type and not burden the caller with doing it. Additionally, in process.wait() we can do the try await io.wait() just as we do in handleProcess right now. Seems like it'd clean things up a bit.
Application.handleProcess(processIO:process:)becomesprocessIO.handleProcess(process:log:).Type of Change
Motivation and Context
This code shouldn't be in the CLI, it should be part of ContainerClient.
Testing