From 409470d0bc54e60b3a6f9cae338da750c1f50233 Mon Sep 17 00:00:00 2001 From: Lisa Milne Date: Thu, 14 Dec 2023 16:10:00 +1000 Subject: [PATCH] add sleep() and sleep command --- clite/commands.js | 47 +++++++++++++++++++++++++++++++++++++++++++++++ clite/core.js | 6 ++++-- clite/libstd.js | 6 ++++++ 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/clite/commands.js b/clite/commands.js index d840e3e..dc41ea8 100644 --- a/clite/commands.js +++ b/clite/commands.js @@ -1535,6 +1535,53 @@ Options: return main(args); }); +clite.commands.load('sleep',function(args,env,io) { + var stdio = io.include('stdio'); + var stdlib = io.include('stdlib'); + + function help() { + stdio.printf(` +sleep - suspend execution for a time +Usage: sleep [OPTION] + +Options: +-? Print this help information +`); + } + + function scb(r) { + io.exit(0); + } + + function main(args) { + var seconds = 0; + for (var i=1; i