nextcloud-desktop/admin/osx/craft-client.swift
Claudio Cambra e6d0f80465 Start working on mac builder script
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2024-07-08 15:41:45 +08:00

28 lines
595 B
Swift

import Foundation
@discardableResult
func run(
_ launchPath: String,
_ args: [String],
env: [String: String]? = nil,
quiet: Bool = false
) -> Int32 {
let task = Process()
task.launchPath = launchPath
task.arguments = args
if let env,
let combinedEnv = task.environment?.merging(env, uniquingKeysWith: { (_, new) in new })
{
task.environment = combinedEnv
}
if quiet {
task.standardOutput = nil
task.standardError = nil
}
task.launch()
task.waitUntilExit()
return task.terminationStatus
}