Avatar
Avatar
t.ae
@swift-5.10.1 import Foundation func cat(length: Int) throws { let data = Data(repeating: 0, count: length) let (stdin, stdout, stderr) = (Pipe(), Pipe(), Pipe()) let process = Process() process.standardInput = stdin process.standardOutput = stdout process.standardError = stderr process.executableURL = URL(fileURLWithPath: "/bin/cat") try process.run() print("write:\(length)") try stdin.fileHandleForWriting.write(contentsOf: data) print("close:\(length)") try stdin.fileHandleForWriting.close() print("waitUntilExit:\(length)") process.waitUntilExit() print("finished:\(length)") } try cat(length: 100) try cat(length: 102400)
swift510 BOT 4/5/2024 12:12 AM
execution timeout with no output