MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / CustomShell

Function CustomShell

source/binding/NodeJS/src/apis/callback.cpp:394–410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392}
393
394MaaBool 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
412MaaBool CustomInactive(void* trans_arg)
413{

Callers

nothing calls this directly

Calls 4

StringBufferClass · 0.70
CallMethod · 0.45
EnvMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected