Avatar
@swift-5.10.1 import Foundation let process = Process() process.executableURL = URL(fileURLWithPath: "/bin/sh") process.arguments = ["-c", "echo 'Hello, World!'"] let stdout = Pipe() process.standardOutput = stdout try process.run() let stdoutData = stdout.fileHandleForReading.readDataToEndOfFile() let stdoutString = String(data: stdoutData, encoding: .utf8)! // #if arch(arm64) && os(Linux) // while process.isRunning {} // #endif process.waitUntilExit() print(stdoutString)