(command, argument = "")
| 3796 | } |
| 3797 | |
| 3798 | async function runShadowrocketNodeCommand(command, argument = "") { |
| 3799 | const args = [command]; |
| 3800 | if (argument) args.push(argument); |
| 3801 | const result = await runCommand(shadowrocketNodeControlPath, args, { timeout: command === "check" ? 15000 : 8000, allowFailure: true }); |
| 3802 | const output = result.output.trim(); |
| 3803 | return { |
| 3804 | ok: result.status === 0, |
| 3805 | summary: result.status === 0 ? `Shadowrocket node ${command}` : `Shadowrocket node ${command} failed`, |
| 3806 | reply: trimIMessageCommandOutput(output || `节点命令没有输出:${command}`) |
| 3807 | }; |
| 3808 | } |
| 3809 | |
| 3810 | async function prepareShadowrocketNodeSwitch(target) { |
| 3811 | const resolved = await runCommand(shadowrocketNodeControlPath, ["resolve", target], { timeout: 8000, allowFailure: true }); |
no test coverage detected