萝卜L

导航

统计

Lua wait sleep

  • 使用os.execute 执行涉及等待、超时的外部命令、程序。配合 >nul 不显示标准输出流信息。执行过程是阻塞(block)等待的。
    • os.execute"ping 1.1.1.1 /n 1 /w <time in milliseconds> >nul"  ,如os.execute"ping 1.1.1.1 /n 1 /w 1000 >nul" 。
    • os.execute"CHOICE /n /d:y /c:yn /t:1 >nul" 。
    • 为(Windows)系统安装GNU命令包(minGW?)。

>sleep --help
Usage: sleep NUMBER[SUFFIX]...
or: sleep OPTION
Pause for NUMBER seconds. SUFFIX may be `s' for seconds (the default),
`m' for minutes, `h' for hours or `d' for days. Unlike most implementations
that require NUMBER be an integer, here NUMBER may be an arbitrary floating
point number.

--help display this help and exit
--version output version information and exit

Report bugs to <bug-coreutils@gnu.org>.

进而可以 os.execute"sleep 1" 。

posted on   萝卜L  阅读(813)  评论(0编辑  收藏  举报

编辑推荐:
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
点击右上角即可分享
微信分享提示