Skip to content

Commit 653d7ef

Browse files
committed
Fix that service app can't be relaunched
1 parent f9385e1 commit 653d7ef

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

CommunicationBridge/main.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1+
import AppKit
12
import Foundation
23

4+
class AppDelegate: NSObject, NSApplicationDelegate {}
5+
36
let bundleIdentifierBase = Bundle(url: Bundle.main.bundleURL.appendingPathComponent(
47
"CopilotForXcodeExtensionService.app"
58
))?.object(forInfoDictionaryKey: "BUNDLE_IDENTIFIER_BASE") as? String ?? "com.intii.CopilotForXcode"
69

710
let serviceIdentifier = bundleIdentifierBase + ".CommunicationBridge"
8-
11+
let appDelegate = AppDelegate()
912
let delegate = ServiceDelegate()
1013
let listener = NSXPCListener(machServiceName: serviceIdentifier)
1114
listener.delegate = delegate
1215
listener.resume()
13-
RunLoop.main.run()
16+
let app = NSApplication.shared
17+
app.delegate = appDelegate
18+
app.run()
1419

Tool/Sources/XPCShared/XPCCommunicationBridge.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public enum XPCCommunicationBridgeError: Swift.Error, LocalizedError {
1010
case .failedToCreateXPCConnection:
1111
return "Failed to create XPC connection."
1212
case let .xpcServiceError(error):
13-
return "XPC Service error: \(error.localizedDescription)"
13+
return "Connection to communication bridge error: \(error.localizedDescription)"
1414
}
1515
}
1616
}

Tool/Sources/XPCShared/XPCExtensionService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public enum XPCExtensionServiceError: Swift.Error, LocalizedError {
1313
case .failedToCreateXPCConnection:
1414
return "Failed to create XPC connection."
1515
case let .xpcServiceError(error):
16-
return "XPC Service error: \(error.localizedDescription)"
16+
return "Connection to extension service error: \(error.localizedDescription)"
1717
}
1818
}
1919
}

0 commit comments

Comments
 (0)