mirror of
https://github.com/rememberber/MooTool.git
synced 2026-12-01 03:18:19 +08:00
Implement the SwiftUI and AppKit product through 0.6.0, including Electron-aligned workspaces, note image attachments, portable backups, and native layouts. Add independent packaging, CI, release notes, and verification records. Validation: 48 core test groups, native interaction and fresh-launch checks, 76 view captures, 15 focused note layout checks, and verified Universal DMG.
19 lines
833 B
Swift
19 lines
833 B
Swift
import Foundation
|
|
import Darwin
|
|
import MooToolNextCore
|
|
|
|
// The parent normally cancels at three seconds. This independent deadline also
|
|
// stops a pathological expression if the main application exits unexpectedly.
|
|
_ = signal(SIGALRM, SIG_DFL)
|
|
alarm(4)
|
|
|
|
do {
|
|
let input = try FileHandle.standardInput.read(upToCount: 16 * 1024 * 1024 + 1) ?? Data()
|
|
guard input.count <= 16 * 1024 * 1024 else { throw ToolError("输入超过 16 MB。") }
|
|
let request = try JSONDecoder().decode(JSONEngineRequest.self, from: input)
|
|
let reply = try JSONEngine.evaluateLocally(request)
|
|
try FileHandle.standardOutput.write(contentsOf: JSONEncoder().encode(reply))
|
|
} catch {
|
|
if let data = try? JSONSerialization.data(withJSONObject: ["error": error.localizedDescription]) { try? FileHandle.standardOutput.write(contentsOf: data) }
|
|
}
|