Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Find the stand-in vphone-vm by an argument vector it leaves alone

Lakr23375e434564a5b
diff --git a/VPhoneKit/VPhoneCoreKitTests/VirtualMachine/LaunchLayoutTests.swift b/VPhoneKit/VPhoneCoreKitTests/VirtualMachine/LaunchLayoutTests.swift
index 5130087e..01dc5365 100644
--- a/VPhoneKit/VPhoneCoreKitTests/VirtualMachine/LaunchLayoutTests.swift
+++ b/VPhoneKit/VPhoneCoreKitTests/VirtualMachine/LaunchLayoutTests.swift
@@ -146,14 +146,16 @@ struct LaunchLayoutTests {
defer { try? FileManager.default.removeItem(at: root) }
// A stand-in that lives long enough to be found under the right name.
let program = root.appendingPathComponent("vphone-vm")
- try FileManager.default.copyItem(at: URL(fileURLWithPath: "/usr/bin/yes"), to: program)
+ try FileManager.default.copyItem(at: URL(fileURLWithPath: "/bin/cat"), to: program)
let config = root.appendingPathComponent("config.plist")
let other = root.appendingPathComponent("other.plist")
let process = Process()
process.executableURL = program
- // yes prints its arguments and blocks once the unread pipe fills.
- process.arguments = ["--config", config.path]
- process.standardOutput = Pipe()
+ // cat reads "-" first and blocks on a pipe that is never written to.
+ // Not yes: on macOS 26 it writes a newline over the NUL that ends its
+ // first argument, which runs "--config" into the path.
+ process.arguments = ["-", "--config", config.path]
+ process.standardInput = Pipe()
try process.run()
defer { process.terminate() }
Thread.sleep(forTimeInterval: 0.2)