fix container and coroutine

This commit is contained in:
crazywhalecc
2022-08-14 18:24:59 +08:00
committed by Jerry Ma
parent 8be7207c3c
commit da6000b4da
6 changed files with 40 additions and 7 deletions

View File

@@ -2,6 +2,9 @@
declare(strict_types=1);
use OneBot\Driver\Coroutine\Adaptive;
use OneBot\Driver\Coroutine\CoroutineInterface;
use OneBot\Driver\Process\ExecutionResult;
use OneBot\V12\Object\MessageSegment;
use Psr\Log\LoggerInterface;
use ZM\Container\Container;
@@ -28,6 +31,34 @@ function zm_dir(string $dir): string
return str_replace('/', DIRECTORY_SEPARATOR, $dir);
}
/**
* 执行shell指令
*
* @param string $cmd 命令行
*/
function zm_exec(string $cmd): ExecutionResult
{
return Adaptive::exec($cmd);
}
/**
* sleep 指定时间单位为秒最小单位为1毫秒即0.001
*
* @param float|int $time
*/
function zm_sleep($time)
{
Adaptive::sleep($time);
}
/**
* 获取协程接口
*/
function coroutine(): ?CoroutineInterface
{
return Adaptive::getCoroutine();
}
/**
* 获取内部错误码
*