瀏覽代碼

vm(qemu): fix hang when vm was improperly stopped

osy 1 年之前
父節點
當前提交
f2f9db1efb
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      Services/UTMPipeInterface.swift

+ 4 - 4
Services/UTMPipeInterface.swift

@@ -106,10 +106,10 @@ extension UTMPipeInterface {
 
     private func cleanupPipes() {
         // unblock any un-opened pipes
-        _ = try? openPipe(at: monitorOutPipeURL, forReading: false)
-        _ = try? openPipe(at: monitorInPipeURL, forReading: true)
-        _ = try? openPipe(at: guestAgentOutPipeURL, forReading: false)
-        _ = try? openPipe(at: guestAgentInPipeURL, forReading: true)
+        _ = try? FileHandle(forUpdating: monitorOutPipeURL)
+        _ = try? FileHandle(forUpdating: monitorInPipeURL)
+        _ = try? FileHandle(forUpdating: guestAgentOutPipeURL)
+        _ = try? FileHandle(forUpdating: guestAgentInPipeURL)
         pipeIOQueue.sync {
             if let monitorOutPipeURL = monitorOutPipeURL {
                 try? fileManager.removeItem(at: monitorOutPipeURL)