mirror of
https://github.com/mobile-next/mobile-mcp.git
synced 2026-10-02 01:05:27 +08:00
fix: catch system signals for clean v8 exit (#366)
This commit is contained in:
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"all": true,
|
||||
"src": ["src"],
|
||||
"include": ["src/**/*.ts"],
|
||||
"reporter": ["text", "html"]
|
||||
"include": ["lib/**/*.js"],
|
||||
"exclude": ["node_modules/**", "lib/**/*.js.map"],
|
||||
"reporter": ["html", "text"],
|
||||
"temp-directory": "./coverage/tmp"
|
||||
}
|
||||
|
||||
@@ -76,6 +76,17 @@ const startStdioServer = async () => {
|
||||
const server = createMcpServer();
|
||||
await server.connect(transport);
|
||||
|
||||
// Exit cleanly on termination signals so node flushes pending work
|
||||
// (including NODE_V8_COVERAGE output). Node's default SIGINT/SIGTERM
|
||||
// handling terminates the process without writing the coverage file,
|
||||
// which makes the `test:mcp` report come back all zeros.
|
||||
const shutdown = () => {
|
||||
process.exit(0);
|
||||
};
|
||||
|
||||
process.on("SIGINT", shutdown);
|
||||
process.on("SIGTERM", shutdown);
|
||||
|
||||
error("mobile-mcp server running on stdio");
|
||||
} catch (err: any) {
|
||||
console.error("Fatal error in main():", err);
|
||||
|
||||
+15
-7
@@ -34,16 +34,24 @@ export interface MobilecliDevicesOptions {
|
||||
type?: "real" | "emulator" | "simulator";
|
||||
}
|
||||
|
||||
export interface MobilecliDeviceProvider {
|
||||
type: string; // e.g. "mobilefleet" for remote devices
|
||||
allocationId?: string;
|
||||
}
|
||||
|
||||
export interface MobilecliDevice {
|
||||
id: string;
|
||||
name: string;
|
||||
platform: "android" | "ios";
|
||||
type: "real" | "emulator" | "simulator";
|
||||
version: string;
|
||||
provider?: MobilecliDeviceProvider;
|
||||
}
|
||||
|
||||
export interface MobilecliDevicesResponse {
|
||||
status: "ok";
|
||||
data: {
|
||||
devices: Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
platform: "android" | "ios";
|
||||
type: "real" | "emulator" | "simulator";
|
||||
version: string;
|
||||
}>;
|
||||
devices: MobilecliDevice[];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user