mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 03:50:08 +02:00
👌 Cleanup
This commit is contained in:
@ -126,8 +126,8 @@ class RealShell: ShellProtocol {
|
||||
withTimeout timeout: TimeInterval = 5.0
|
||||
) async throws -> (Process, ShellOutput) {
|
||||
let task = getShellProcess(for: command)
|
||||
// TODO: Make ShellOutput a struct again and add a class type for this use case only
|
||||
let output = ShellOutput(out: "", err: "")
|
||||
|
||||
let output = ShellOutput.empty()
|
||||
|
||||
task.listen { incoming in
|
||||
output.out += incoming; didReceiveOutput(incoming, .stdOut)
|
||||
|
@ -65,6 +65,10 @@ class ShellOutput {
|
||||
self.err = err
|
||||
}
|
||||
|
||||
static func empty() -> ShellOutput {
|
||||
return ShellOutput(out: "", err: "")
|
||||
}
|
||||
|
||||
static func out(_ out: String?, _ err: String? = nil) -> ShellOutput {
|
||||
return ShellOutput(out: out ?? "", err: err ?? "")
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ struct BatchFakeShellOutput: Codable {
|
||||
didReceiveOutput: @escaping (String, ShellStream) -> Void,
|
||||
ignoreDelay: Bool = false
|
||||
) async -> ShellOutput {
|
||||
var output = ShellOutput(out: "", err: "")
|
||||
let output = ShellOutput.empty()
|
||||
|
||||
for item in items {
|
||||
if !ignoreDelay {
|
||||
|
Reference in New Issue
Block a user