Expand shared Sprinter MCP with managed launch, raw reads and key input
This commit is contained in:
@@ -4,7 +4,7 @@ import argparse
|
||||
import json
|
||||
import sys
|
||||
|
||||
from sdbg.server import rpc_call
|
||||
from sdbg.server import RPC_GENERATION_MUTATIONS, rpc_call
|
||||
from sdbg.session import SessionError
|
||||
|
||||
|
||||
@@ -19,8 +19,16 @@ def main():
|
||||
arguments = json.loads(args.arguments)
|
||||
if not isinstance(arguments, dict):
|
||||
raise ValueError('arguments должен быть JSON-объектом')
|
||||
identity = {}
|
||||
if args.method != 'status':
|
||||
status = rpc_call(args.socket, 'status')
|
||||
identity = {'session_id': status['session_id'],
|
||||
'build_id': status['build_id']}
|
||||
if args.method in RPC_GENERATION_MUTATIONS:
|
||||
identity['generation'] = status['generation']
|
||||
result = rpc_call(args.socket, args.method, arguments,
|
||||
timeout=35 if args.method == 'events' else 10)
|
||||
timeout=35 if args.method == 'events' else 10,
|
||||
**identity)
|
||||
print(json.dumps(result, ensure_ascii=False, indent=2))
|
||||
return 0
|
||||
except (SessionError, ValueError, OSError) as error:
|
||||
|
||||
Reference in New Issue
Block a user