| 392 | } |
| 393 | |
| 394 | MaaBool CustomShell(const char* cmd, int64_t timeout, void* trans_arg, MaaStringBuffer* buffer) |
| 395 | { |
| 396 | auto customCtx = reinterpret_cast<CustomControllerContext*>(trans_arg); |
| 397 | auto ctx = customCtx->callbacks["shell"]; |
| 398 | auto result = ctx->Call<std::optional<std::string>>([&](maajs::FunctionType func) { |
| 399 | return func.Call( |
| 400 | { |
| 401 | maajs::StringType::New(func.Env(), cmd), |
| 402 | maajs::NumberType::New(func.Env(), static_cast<double>(timeout)), |
| 403 | }); |
| 404 | }); |
| 405 | if (result) { |
| 406 | StringBuffer(buffer, false).set(*result); |
| 407 | return true; |
| 408 | } |
| 409 | return false; |
| 410 | } |
| 411 | |
| 412 | MaaBool CustomInactive(void* trans_arg) |
| 413 | { |
nothing calls this directly
no test coverage detected