android-midscene-automation 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server/http-api.ts +9 -1
package/package.json
CHANGED
package/server/http-api.ts
CHANGED
|
@@ -94,6 +94,10 @@ function writeNdjson(res: ServerResponse, event: RunGeneratedScriptEvent | { typ
|
|
|
94
94
|
res.write(`${JSON.stringify(event)}\n`);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
function npxCommand() {
|
|
98
|
+
return process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
|
99
|
+
}
|
|
100
|
+
|
|
97
101
|
type AndroidDevice = {
|
|
98
102
|
id: string;
|
|
99
103
|
status: string;
|
|
@@ -506,7 +510,7 @@ export function createApiMiddleware() {
|
|
|
506
510
|
};
|
|
507
511
|
}
|
|
508
512
|
|
|
509
|
-
playgroundProcess = spawn(
|
|
513
|
+
playgroundProcess = spawn(npxCommand(), ['--yes', '@midscene/android-playground'], {
|
|
510
514
|
cwd: appPath(),
|
|
511
515
|
env: {
|
|
512
516
|
...process.env,
|
|
@@ -515,6 +519,10 @@ export function createApiMiddleware() {
|
|
|
515
519
|
stdio: 'ignore',
|
|
516
520
|
detached: false,
|
|
517
521
|
});
|
|
522
|
+
playgroundProcess.once('error', (error) => {
|
|
523
|
+
console.warn(`Android Playground 启动失败:${error.message}`);
|
|
524
|
+
playgroundProcess = null;
|
|
525
|
+
});
|
|
518
526
|
playgroundProcess.once('exit', () => {
|
|
519
527
|
playgroundProcess = null;
|
|
520
528
|
});
|